Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-05-17 02:48:21 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-18 00:35:35 +0300
commit6373cb598e1a4e0340583ad75d5abba01ff79774 (patch)
treed9d49fbbc92bebbd228816ca736af7b23403c74f /builtin/fetch.c
parent60fba4bf1670e6eabd61b04ebf86efedff866a50 (diff)
refspec: consolidate ref-prefix generation logic
When using protocol v2 a client constructs a list of ref-prefixes which are sent across the wire so that the server can do server-side filtering of the ref-advertisement. The logic that does this exists for both fetch and push (even though no push support for v2 currently exists yet) and is roughly the same so lets consolidate this logic and make it general enough that it can be used for both the push and fetch cases. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 3fad1f0db9..80bb143707 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -351,18 +351,7 @@ static struct ref *get_ref_map(struct transport *transport,
const struct ref *remote_refs;
- for (i = 0; i < rs->nr; i++) {
- const struct refspec_item *item = &rs->items[i];
- if (!item->exact_sha1) {
- const char *glob = strchr(item->src, '*');
- if (glob)
- argv_array_pushf(&ref_prefixes, "%.*s",
- (int)(glob - item->src),
- item->src);
- else
- expand_ref_prefix(&ref_prefixes, item->src);
- }
- }
+ refspec_ref_prefixes(rs, &ref_prefixes);
remote_refs = transport_get_remote_refs(transport, &ref_prefixes);