Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote: convert check_push_refs to use struct refspec
author
Brandon Williams
<bmwill@google.com>
Wed, 16 May 2018 22:57:56 +0000
(15:57 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 17 May 2018 21:19:42 +0000
(06:19 +0900)
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>
remote.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e03c4e0
)
diff --git
a/remote.c
b/remote.c
index 89820c47691f0bfd28b0f94c750f57ec20c005bd..1918551182fd40dfcea05ae4aec75805bf369b81 100644
(file)
--- a/
remote.c
+++ b/
remote.c
@@
-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)
{
*/
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;
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;
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);
}
ret |= match_explicit_lhs(src, rs, NULL, NULL);
}
-
free_refspec(nr_refspec,
refspec);
+
refspec_clear(&
refspec);
return ret;
}
return ret;
}