diff options
| -rw-r--r-- | builtin/fetch.c | 10 | ||||
| -rwxr-xr-x | t/t5702-protocol-v2.sh | 14 |
2 files changed, 18 insertions, 6 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index f142756441..6ab101fa6d 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1778,16 +1778,14 @@ static int do_fetch(struct transport *transport, if (tags == TAGS_SET || tags == TAGS_DEFAULT) { must_list_refs = 1; - if (transport_ls_refs_options.ref_prefixes.nr) - strvec_push(&transport_ls_refs_options.ref_prefixes, - "refs/tags/"); + strvec_push(&transport_ls_refs_options.ref_prefixes, + "refs/tags/"); } if (uses_remote_tracking(transport, rs)) { must_list_refs = 1; - if (transport_ls_refs_options.ref_prefixes.nr) - strvec_push(&transport_ls_refs_options.ref_prefixes, - "HEAD"); + strvec_push(&transport_ls_refs_options.ref_prefixes, + "HEAD"); } if (must_list_refs) { diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 2f0a52a72d..626deb05f0 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -682,6 +682,7 @@ test_expect_success 'default refspec is used to filter ref when fetching' ' test_expect_success 'set up parent for prefix tests' ' git init prefix-parent && git -C prefix-parent commit --allow-empty -m foo && + git -C prefix-parent tag my-tag && git -C prefix-parent branch unrelated-branch ' @@ -694,6 +695,19 @@ test_expect_success 'empty refspec filters refs when fetching' ' test_grep ! unrelated-branch log ' +test_expect_success 'exact oid fetch with tag following' ' + git init exact-oid-tags && + + commit=$(git -C prefix-parent rev-parse --verify HEAD) && + + test_when_finished "rm -f log" && + GIT_TRACE_PACKET="$(pwd)/log" \ + git -C exact-oid-tags fetch ../prefix-parent \ + $commit:refs/heads/exact && + test_grep ! unrelated-branch log && + git -C exact-oid-tags rev-parse --verify my-tag +' + test_expect_success 'fetch supports various ways of have lines' ' rm -rf server client trace && git init server && |
