summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Brandon Williams <bmwill@google.com>2018-05-16 16:48:22 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-18 06:35:37 +0900
commitdcc73cf7ffd17e68bda05fff4c139465580aff28 (patch)
treeee4686099c014f6b78cc5fea93980e52020fd9c6 /builtin
parentrefspec: consolidate ref-prefix generation logic (diff)
downloadtgif-dcc73cf7ffd17e68bda05fff4c139465580aff28.tar.xz
fetch: generate ref-prefixes when using a configured refspec
Teach fetch to generate ref-prefixes, to be used for server-side filtering of the ref-advertisement, based on the configured fetch refspec ('remote.<name>.fetch') when no user provided refspec exists. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 80bb143707..7cc7a52dee 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -351,7 +351,15 @@ static struct ref *get_ref_map(struct transport *transport,
const struct ref *remote_refs;
- refspec_ref_prefixes(rs, &ref_prefixes);
+ if (rs->nr)
+ refspec_ref_prefixes(rs, &ref_prefixes);
+ else if (transport->remote && transport->remote->fetch.nr)
+ refspec_ref_prefixes(&transport->remote->fetch, &ref_prefixes);
+
+ if (ref_prefixes.argc &&
+ (tags == TAGS_SET || (tags == TAGS_DEFAULT && !rs->nr))) {
+ argv_array_push(&ref_prefixes, "refs/tags/");
+ }
remote_refs = transport_get_remote_refs(transport, &ref_prefixes);