diff options
-rw-r--r-- | cache-tree.c | 2 | ||||
-rwxr-xr-x | t/t0410-partial-clone.sh | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/cache-tree.c b/cache-tree.c index c22161f987..9e596893bc 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -407,7 +407,7 @@ static int update_one(struct cache_tree *it, if (repair) { struct object_id oid; hash_object_file(buffer.buf, buffer.len, tree_type, &oid); - if (has_object_file(&oid)) + if (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT)) oidcpy(&it->oid, &oid); else to_invalidate = 1; diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index 6415063980..3e434b6a81 100755 --- a/t/t0410-partial-clone.sh +++ b/t/t0410-partial-clone.sh @@ -492,6 +492,20 @@ test_expect_success 'gc stops traversal when a missing but promised object is re ! grep "$TREE_HASH" out ' +test_expect_success 'do not fetch when checking existence of tree we construct ourselves' ' + rm -rf repo && + test_create_repo repo && + test_commit -C repo base && + test_commit -C repo side1 && + git -C repo checkout base && + test_commit -C repo side2 && + + git -C repo config core.repositoryformatversion 1 && + git -C repo config extensions.partialclone "arbitrary string" && + + git -C repo cherry-pick side1 +' + . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd |