Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote: convert match_push_refs to use struct refspec
author
Brandon Williams
<bmwill@google.com>
Wed, 16 May 2018 22:57:57 +0000
(15:57 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 17 May 2018 21:19:42 +0000
(06:19 +0900)
Convert 'match_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:
0460f47
)
diff --git
a/remote.c
b/remote.c
index 1918551182fd40dfcea05ae4aec75805bf369b81..bce6e7ce4cd904442007b009710f407d201d2f66 100644
(file)
--- a/
remote.c
+++ b/
remote.c
@@
-1312,7
+1312,7
@@
int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
int match_push_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int flags)
{
int match_push_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int flags)
{
- struct refspec
_item *rs
;
+ struct refspec
rs = REFSPEC_INIT_PUSH
;
int send_all = flags & MATCH_REFS_ALL;
int send_mirror = flags & MATCH_REFS_MIRROR;
int send_prune = flags & MATCH_REFS_PRUNE;
int send_all = flags & MATCH_REFS_ALL;
int send_mirror = flags & MATCH_REFS_MIRROR;
int send_prune = flags & MATCH_REFS_PRUNE;
@@
-1325,8
+1325,8
@@
int match_push_refs(struct ref *src, struct ref **dst,
nr_refspec = 1;
refspec = default_refspec;
}
nr_refspec = 1;
refspec = default_refspec;
}
- r
s = parse_push_refspec(nr_refspec, (const char **)
refspec);
- errs = match_explicit_refs(src, *dst, &dst_tail, rs
, nr_refspec
);
+ r
efspec_appendn(&rs, refspec, nr_
refspec);
+ errs = match_explicit_refs(src, *dst, &dst_tail, rs
.items, rs.nr
);
/* pick the remainder */
for (ref = src; ref; ref = ref->next) {
/* pick the remainder */
for (ref = src; ref; ref = ref->next) {
@@
-1335,7
+1335,7
@@
int match_push_refs(struct ref *src, struct ref **dst,
const struct refspec_item *pat = NULL;
char *dst_name;
const struct refspec_item *pat = NULL;
char *dst_name;
- dst_name = get_ref_match(rs
, nr_refspec
, ref, send_mirror, FROM_SRC, &pat);
+ dst_name = get_ref_match(rs
.items, rs.nr
, ref, send_mirror, FROM_SRC, &pat);
if (!dst_name)
continue;
if (!dst_name)
continue;
@@
-1384,7
+1384,7
@@
int match_push_refs(struct ref *src, struct ref **dst,
/* We're already sending something to this ref. */
continue;
/* We're already sending something to this ref. */
continue;
- src_name = get_ref_match(rs
, nr_refspec
, ref, send_mirror, FROM_DST, NULL);
+ src_name = get_ref_match(rs
.items, rs.nr
, ref, send_mirror, FROM_DST, NULL);
if (src_name) {
if (!src_ref_index.nr)
prepare_ref_index(&src_ref_index, src);
if (src_name) {
if (!src_ref_index.nr)
prepare_ref_index(&src_ref_index, src);
@@
-1396,6
+1396,9
@@
int match_push_refs(struct ref *src, struct ref **dst,
}
string_list_clear(&src_ref_index, 0);
}
}
string_list_clear(&src_ref_index, 0);
}
+
+ refspec_clear(&rs);
+
if (errs)
return -1;
return 0;
if (errs)
return -1;
return 0;