1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

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>
This commit is contained in:
Brandon Williams 2018-05-16 15:57:53 -07:00 committed by Junio C Hamano
parent c8fa9efe3a
commit 9c8361b289

View File

@ -1744,13 +1744,14 @@ static int push_check(int argc, const char **argv, const char *prefix)
/* Check the refspec */
if (argc > 2) {
int i, refspec_nr = argc - 2;
int i;
struct ref *local_refs = get_local_heads();
struct refspec_item *refspec = parse_push_refspec(refspec_nr,
argv + 2);
struct refspec refspec = REFSPEC_INIT_PUSH;
for (i = 0; i < refspec_nr; i++) {
struct refspec_item *rs = refspec + i;
refspec_appendn(&refspec, argv + 2, argc - 2);
for (i = 0; i < refspec.nr; i++) {
const struct refspec_item *rs = &refspec.items[i];
if (rs->pattern || rs->matching)
continue;
@ -1777,7 +1778,7 @@ static int push_check(int argc, const char **argv, const char *prefix)
rs->src);
}
}
free_refspec(refspec_nr, refspec);
refspec_clear(&refspec);
}
free(head);