1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-20 13:26:08 +02:00

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
This commit is contained in:
Junio C Hamano 2020-04-22 13:42:50 -07:00
commit 3ea2b46628
2 changed files with 11 additions and 1 deletions

View File

@ -643,7 +643,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
continue;
if (ends_with(ref->name, "^{}"))
continue;
if (!has_object_file(&ref->old_oid))
if (!has_object_file_with_flags(&ref->old_oid,
OBJECT_INFO_QUICK |
OBJECT_INFO_SKIP_FETCH_OBJECT))
continue;
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);

View File

@ -415,6 +415,14 @@ test_expect_success 'verify fetch downloads only one pack when updating refs' '
test_line_count = 3 pack-list
'
test_expect_success 'single-branch tag following respects partial clone' '
git clone --single-branch -b B --filter=blob:none \
"file://$(pwd)/srv.bare" single &&
git -C single rev-parse --verify refs/tags/B &&
git -C single rev-parse --verify refs/tags/A &&
test_must_fail git -C single rev-parse --verify refs/tags/C
'
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd