summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Jonathan Tan <jonathantanmy@google.com>2018-06-05 14:40:36 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-07-24 08:54:17 -0700
commit2b554353a5f0463dec44b827e2d1423b698d06d3 (patch)
treed5eeed2bdaf171b6c83dfbf2dc5603456bfc5686 /builtin
parentt5702: test fetch with multiple refspecs at a time (diff)
downloadtgif-2b554353a5f0463dec44b827e2d1423b698d06d3.tar.xz
fetch: send "refs/tags/" prefix upon CLI refspecs
When performing tag following, in addition to using the server's "include-tag" capability to send tag objects (and emulating it if the server does not support that capability), "git fetch" relies upon the presence of refs/tags/* entries in the initial ref advertisement to locally create refs pointing to the aforementioned tag objects. When using protocol v2, refs/tags/* entries in the initial ref advertisement may be suppressed by a ref-prefix argument, leading to the tag object being downloaded, but the ref not being created. Commit dcc73cf7ff ("fetch: generate ref-prefixes when using a configured refspec", 2018-05-18) ensured that "refs/tags/" is always sent as a ref prefix when "git fetch" is invoked with no refspecs, but not when "git fetch" is invoked with refspecs. Extend that functionality to make it work in both situations. This also necessitates a change another test which tested ref advertisement filtering using tag refs - since tag refs are sent by default now, the test has been switched to using branch refs instead. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ea5b9669ad..1f447f1e8c 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -359,7 +359,7 @@ static struct ref *get_ref_map(struct transport *transport,
refspec_ref_prefixes(&transport->remote->fetch, &ref_prefixes);
if (ref_prefixes.argc &&
- (tags == TAGS_SET || (tags == TAGS_DEFAULT && !rs->nr))) {
+ (tags == TAGS_SET || tags == TAGS_DEFAULT)) {
argv_array_push(&ref_prefixes, "refs/tags/");
}