Skip to content

Commit 3ea2b46

Browse files
committed
Merge branch 'jk/use-quick-lookup-in-clone-for-tag-following'
The logic to auto-follow tags by "git clone --single-branch" was not careful to avoid lazy-fetching unnecessary tags, which has been corrected. * jk/use-quick-lookup-in-clone-for-tag-following: clone: use "quick" lookup while following tags
2 parents f72e067 + 167a575 commit 3ea2b46

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

builtin/clone.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
643643
continue;
644644
if (ends_with(ref->name, "^{}"))
645645
continue;
646-
if (!has_object_file(&ref->old_oid))
646+
if (!has_object_file_with_flags(&ref->old_oid,
647+
OBJECT_INFO_QUICK |
648+
OBJECT_INFO_SKIP_FETCH_OBJECT))
647649
continue;
648650
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
649651
UPDATE_REFS_DIE_ON_ERR);

t/t5616-partial-clone.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,14 @@ test_expect_success 'verify fetch downloads only one pack when updating refs' '
415415
test_line_count = 3 pack-list
416416
'
417417

418+
test_expect_success 'single-branch tag following respects partial clone' '
419+
git clone --single-branch -b B --filter=blob:none \
420+
"file://$(pwd)/srv.bare" single &&
421+
git -C single rev-parse --verify refs/tags/B &&
422+
git -C single rev-parse --verify refs/tags/A &&
423+
test_must_fail git -C single rev-parse --verify refs/tags/C
424+
'
425+
418426
. "$TEST_DIRECTORY"/lib-httpd.sh
419427
start_httpd
420428

0 commit comments

Comments
 (0)