submodule--helper: convert push_check to use struct refspec

Convert 'push_check()' 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 9c8361b289dea10dcb8d2f0cd7c95840340455dd
1 file changed +7 -6
builtin/submodule--helper.c
+7 -6
@@ -1744,13 +1744,14 @@ static int push_check(int argc, const char **argv, const char *prefix)
1744
1745 /* Check the refspec */
1746 if (argc > 2) {
1747 - int i, refspec_nr = argc - 2;
1747 + int i;
1748 struct ref *local_refs = get_local_heads();
1749 - struct refspec_item *refspec = parse_push_refspec(refspec_nr,
1750 - argv + 2);
1749 + struct refspec refspec = REFSPEC_INIT_PUSH;
1750
1752 - for (i = 0; i < refspec_nr; i++) {
1753 - struct refspec_item *rs = refspec + i;
1751 + refspec_appendn(&refspec, argv + 2, argc - 2);
1752 +
1753 + for (i = 0; i < refspec.nr; i++) {
1754 + const struct refspec_item *rs = &refspec.items[i];
1755
1756 if (rs->pattern || rs->matching)
1757 continue;
@@ -1777,7 +1778,7 @@ static int push_check(int argc, const char **argv, const char *prefix)
1778 rs->src);
1779 }
1780 }
1780 - free_refspec(refspec_nr, refspec);
1781 + refspec_clear(&refspec);
1782 }
1783 free(head);
1784