Skip to content

Commit 9c8361b

Browse files
bmwillgitster
authored andcommitted
submodule--helper: convert push_check to use struct refspec
Convert 'push_check()' to use 'struct refspec'. Signed-off-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c8fa9ef commit 9c8361b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

builtin/submodule--helper.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,13 +1744,14 @@ static int push_check(int argc, const char **argv, const char *prefix)
17441744

17451745
/* Check the refspec */
17461746
if (argc > 2) {
1747-
int i, refspec_nr = argc - 2;
1747+
int i;
17481748
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;
17511750

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];
17541755

17551756
if (rs->pattern || rs->matching)
17561757
continue;
@@ -1777,7 +1778,7 @@ static int push_check(int argc, const char **argv, const char *prefix)
17771778
rs->src);
17781779
}
17791780
}
1780-
free_refspec(refspec_nr, refspec);
1781+
refspec_clear(&refspec);
17811782
}
17821783
free(head);
17831784

0 commit comments

Comments
 (0)