diff options
author | Brandon Williams <bmwill@google.com> | 2018-05-16 15:57:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-18 06:19:42 +0900 |
commit | 0460f4727793663b34fbf0711f60394de730f833 (patch) | |
tree | 25116fa9392faa06322b910921f1255db64cc515 | |
parent | e03c4e084d89f31dd4569b085d88b60758a54cd1 (diff) | |
download | git-0460f4727793663b34fbf0711f60394de730f833.tar.gz |
remote: convert check_push_refs to use struct refspec
Convert 'check_push_refs()' to use 'struct refspec'.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | remote.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1282,12 +1282,14 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref) */ int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names) { - struct refspec_item *refspec = parse_push_refspec(nr_refspec, refspec_names); + struct refspec refspec = REFSPEC_INIT_PUSH; int ret = 0; int i; - for (i = 0; i < nr_refspec; i++) { - struct refspec_item *rs = refspec + i; + refspec_appendn(&refspec, refspec_names, nr_refspec); + + for (i = 0; i < refspec.nr; i++) { + struct refspec_item *rs = &refspec.items[i]; if (rs->pattern || rs->matching) continue; @@ -1295,7 +1297,7 @@ int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names) ret |= match_explicit_lhs(src, rs, NULL, NULL); } - free_refspec(nr_refspec, refspec); + refspec_clear(&refspec); return ret; } |