Merge branch 'tb/fetch-follow-tags-fix'

* tb/fetch-follow-tags-fix:
  fetch: fix following tags when fetching specific OID
This commit is contained in:
Junio C Hamano
2025-03-10 08:45:58 -07:00
2 changed files with 17 additions and 1 deletions

View File

@@ -1777,7 +1777,9 @@ static int do_fetch(struct transport *transport,
if (uses_remote_tracking(transport, rs)) { if (uses_remote_tracking(transport, rs)) {
must_list_refs = 1; must_list_refs = 1;
strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD"); if (transport_ls_refs_options.ref_prefixes.nr)
strvec_push(&transport_ls_refs_options.ref_prefixes,
"HEAD");
} }
if (must_list_refs) { if (must_list_refs) {

View File

@@ -160,4 +160,18 @@ test_expect_success 'new clone fetch main and tags' '
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'fetch specific OID with tag following' '
git init --bare clone3.git &&
(
cd clone3.git &&
git remote add origin .. &&
git fetch origin $B:refs/heads/main &&
git -C .. for-each-ref >expect &&
git for-each-ref >actual &&
test_cmp expect actual
)
'
test_done test_done