From: Brandon Williams Date: Wed, 16 May 2018 22:57:53 +0000 (-0700) Subject: submodule--helper: convert push_check to use struct refspec X-Git-Tag: v2.18.0-rc1~2^2~31 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9c8361b289dea10dcb8d2f0cd7c95840340455dd submodule--helper: convert push_check to use struct refspec Convert 'push_check()' to use 'struct refspec'. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c0c4db0073..88a149a2c3 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -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);