diff options
author | Brandon Williams <bmwill@google.com> | 2018-05-16 22:57:53 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-17 21:19:42 (GMT) |
commit | 9c8361b289dea10dcb8d2f0cd7c95840340455dd (patch) | |
tree | 0dc367a218605eef28874ceacb18da2594aa6014 /builtin/submodule--helper.c | |
parent | c8fa9efe3a8765f44eacc5b0e114053a0297dfff (diff) | |
download | git-9c8361b289dea10dcb8d2f0cd7c95840340455dd.zip git-9c8361b289dea10dcb8d2f0cd7c95840340455dd.tar.gz git-9c8361b289dea10dcb8d2f0cd7c95840340455dd.tar.bz2 |
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>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r-- | builtin/submodule--helper.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c0c4db0..88a149a 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); |