Skip to content

Commit ae203ba

Browse files
committed
Merge branch 'jt/cache-tree-avoid-lazy-fetch-during-merge'
The cache-tree code has been taught to be less aggressive in attempting to see if a tree object it computed already exists in the repository. * jt/cache-tree-avoid-lazy-fetch-during-merge: cache-tree: do not lazy-fetch tentative tree
2 parents 3f84633 + f981ec1 commit ae203ba

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static int update_one(struct cache_tree *it,
408408
if (repair) {
409409
struct object_id oid;
410410
hash_object_file(buffer.buf, buffer.len, tree_type, &oid);
411-
if (has_object_file(&oid))
411+
if (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
412412
oidcpy(&it->oid, &oid);
413413
else
414414
to_invalidate = 1;

t/t0410-partial-clone.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,20 @@ test_expect_success 'gc stops traversal when a missing but promised object is re
540540
! grep "$TREE_HASH" out
541541
'
542542

543+
test_expect_success 'do not fetch when checking existence of tree we construct ourselves' '
544+
rm -rf repo &&
545+
test_create_repo repo &&
546+
test_commit -C repo base &&
547+
test_commit -C repo side1 &&
548+
git -C repo checkout base &&
549+
test_commit -C repo side2 &&
550+
551+
git -C repo config core.repositoryformatversion 1 &&
552+
git -C repo config extensions.partialclone "arbitrary string" &&
553+
554+
git -C repo cherry-pick side1
555+
'
556+
543557
. "$TEST_DIRECTORY"/lib-httpd.sh
544558
start_httpd
545559

0 commit comments

Comments
 (0)