remote: convert check_push_refs to use struct refspec

Convert 'check_push_refs()' to use 'struct refspec'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed May 16, 2018 at 15:57 UTC 0460f4727793663b34fbf0711f60394de730f833
1 file changed +6 -4
remote.c
+6 -4
@@ -1282,12 +1282,14 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref)
1282 */
1283 int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
1284 {
1285 - struct refspec_item *refspec = parse_push_refspec(nr_refspec, refspec_names);
1285 + struct refspec refspec = REFSPEC_INIT_PUSH;
1286 int ret = 0;
1287 int i;
1288
1289 - for (i = 0; i < nr_refspec; i++) {
1290 - struct refspec_item *rs = refspec + i;
1289 + refspec_appendn(&refspec, refspec_names, nr_refspec);
1290 +
1291 + for (i = 0; i < refspec.nr; i++) {
1292 + struct refspec_item *rs = &refspec.items[i];
1293
1294 if (rs->pattern || rs->matching)
1295 continue;
@@ -1295,7 +1297,7 @@ int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
1297 ret |= match_explicit_lhs(src, rs, NULL, NULL);
1298 }
1299
1298 - free_refspec(nr_refspec, refspec);
1300 + refspec_clear(&refspec);
1301 return ret;
1302 }
1303