remote: convert push refspecs to struct refspec

Convert the set of push refspecs stored in 'struct remote' to use
'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2018-05-16 15:58:00 -07:00
committed by Junio C Hamano
parent 16eefc8eb3
commit 6bdb304b10
4 changed files with 28 additions and 37 deletions

View File

@ -388,8 +388,8 @@ static int get_push_ref_states(const struct ref *remote_refs,
local_refs = get_local_heads();
push_map = copy_ref_list(remote_refs);
match_push_refs(local_refs, &push_map, remote->push_refspec_nr,
remote->push_refspec, MATCH_REFS_NONE);
match_push_refs(local_refs, &push_map, remote->push.raw_nr,
remote->push.raw, MATCH_REFS_NONE);
states->push.strdup_strings = 1;
for (ref = push_map; ref; ref = ref->next) {
@ -435,14 +435,14 @@ static int get_push_ref_states_noquery(struct ref_states *states)
return 0;
states->push.strdup_strings = 1;
if (!remote->push_refspec_nr) {
if (!remote->push.nr) {
item = string_list_append(&states->push, _("(matching)"));
info = item->util = xcalloc(1, sizeof(struct push_info));
info->status = PUSH_STATUS_NOTQUERIED;
info->dest = xstrdup(item->string);
}
for (i = 0; i < remote->push_refspec_nr; i++) {
struct refspec_item *spec = remote->push + i;
for (i = 0; i < remote->push.nr; i++) {
const struct refspec_item *spec = &remote->push.items[i];
if (spec->matching)
item = string_list_append(&states->push, _("(matching)"));
else if (strlen(spec->src))
@ -586,8 +586,8 @@ static int migrate_file(struct remote *remote)
git_config_set_multivar(buf.buf, remote->url[i], "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.push", remote->name);
for (i = 0; i < remote->push_refspec_nr; i++)
git_config_set_multivar(buf.buf, remote->push_refspec[i], "^$", 0);
for (i = 0; i < remote->push.raw_nr; i++)
git_config_set_multivar(buf.buf, remote->push.raw[i], "^$", 0);
strbuf_reset(&buf);
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
for (i = 0; i < remote->fetch_refspec_nr; i++)