summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-05-16 22:58:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-17 21:19:44 (GMT)
commitafb1aed403de404c1e09fae5b8028f6b8f6982d3 (patch)
treed539c201158ef7b72b406287cf10e7374d013ab9 /remote.c
parent5c7ec8462d8706f9731f0d54ea3fdfe810d60a88 (diff)
downloadgit-afb1aed403de404c1e09fae5b8028f6b8f6982d3.zip
git-afb1aed403de404c1e09fae5b8028f6b8f6982d3.tar.gz
git-afb1aed403de404c1e09fae5b8028f6b8f6982d3.tar.bz2
remote: convert check_push_refs to take a struct refspec
Convert 'check_push_refs()' to take a 'struct refspec' as a parameter instead of an array of 'const char *'. 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.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/remote.c b/remote.c
index 0046d4e..0d1a3d0 100644
--- a/remote.c
+++ b/remote.c
@@ -1255,24 +1255,20 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref)
* but we can catch some errors early before even talking to the
* remote side.
*/
-int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
+int check_push_refs(struct ref *src, struct refspec *rs)
{
- struct refspec refspec = REFSPEC_INIT_PUSH;
int ret = 0;
int i;
- refspec_appendn(&refspec, refspec_names, nr_refspec);
-
- for (i = 0; i < refspec.nr; i++) {
- struct refspec_item *rs = &refspec.items[i];
+ for (i = 0; i < rs->nr; i++) {
+ struct refspec_item *item = &rs->items[i];
- if (rs->pattern || rs->matching)
+ if (item->pattern || item->matching)
continue;
- ret |= match_explicit_lhs(src, rs, NULL, NULL);
+ ret |= match_explicit_lhs(src, item, NULL, NULL);
}
- refspec_clear(&refspec);
return ret;
}