summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:58 (GMT)
commitae203ba414f7e0b83f8b07255898a6cff3b5c07e (patch)
tree003629b9873324ec09a786d2c2b2ea90e6e0f58a
parent3f84633563f34e069876106fbe64980a6e1c15c0 (diff)
parentf981ec18cf4a67aca98901a4c152f07e24ef3c5f (diff)
downloadgit-ae203ba414f7e0b83f8b07255898a6cff3b5c07e.zip
git-ae203ba414f7e0b83f8b07255898a6cff3b5c07e.tar.gz
git-ae203ba414f7e0b83f8b07255898a6cff3b5c07e.tar.bz2
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
-rw-r--r--cache-tree.c2
-rwxr-xr-xt/t0410-partial-clone.sh14
2 files changed, 15 insertions, 1 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 0e5724f..62edee4 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -408,7 +408,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 d4b7e53..1e389c0 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -540,6 +540,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