summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-05-16 22:58:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-17 21:19:43 (GMT)
commit86baf82521de70184182972b96bbf1859f097366 (patch)
tree8155a3e2dea2e8a968aa70a35481acc886118941 /remote.c
parentd000414e26654f6f13526e4b83c648d7119586f0 (diff)
downloadgit-86baf82521de70184182972b96bbf1859f097366.zip
git-86baf82521de70184182972b96bbf1859f097366.tar.gz
git-86baf82521de70184182972b96bbf1859f097366.tar.bz2
remote: convert query_refspecs to take a struct refspec
Convert 'query_refspecs()' to take a 'struct refspec' as a parameter instead of a list of 'struct refspec_item'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/remote.c b/remote.c
index 89415a2..dd68e6b 100644
--- a/remote.c
+++ b/remote.c
@@ -725,7 +725,7 @@ static void query_refspecs_multiple(struct refspec *rs,
}
}
-int query_refspecs(struct refspec_item *refs, int ref_count, struct refspec_item *query)
+int query_refspecs(struct refspec *rs, struct refspec_item *query)
{
int i;
int find_src = !query->src;
@@ -735,8 +735,8 @@ int query_refspecs(struct refspec_item *refs, int ref_count, struct refspec_item
if (find_src && !query->dst)
return error("query_refspecs: need either src or dst");
- for (i = 0; i < ref_count; i++) {
- struct refspec_item *refspec = &refs[i];
+ for (i = 0; i < rs->nr; i++) {
+ struct refspec_item *refspec = &rs->items[i];
const char *key = find_src ? refspec->dst : refspec->src;
const char *value = find_src ? refspec->src : refspec->dst;
@@ -763,7 +763,7 @@ char *apply_refspecs(struct refspec *rs, const char *name)
memset(&query, 0, sizeof(struct refspec_item));
query.src = (char *)name;
- if (query_refspecs(rs->items, rs->nr, &query))
+ if (query_refspecs(rs, &query))
return NULL;
return query.dst;
@@ -771,7 +771,7 @@ char *apply_refspecs(struct refspec *rs, const char *name)
int remote_find_tracking(struct remote *remote, struct refspec_item *refspec)
{
- return query_refspecs(remote->fetch.items, remote->fetch.nr, refspec);
+ return query_refspecs(&remote->fetch, refspec);
}
static struct ref *alloc_ref_with_prefix(const char *prefix, size_t prefixlen,