fetch: convert do_fetch to take a struct refspec

Convert 'do_fetch()' to take a 'struct refspec' as a parameter instead of a list of 'struct refspec_item'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed May 16, 2018 at 15:58 UTC 65a1301f2e01b454777bb15328f8071282bee702
1 file changed +5 -5
builtin/fetch.c
+5 -5
@@ -1112,7 +1112,7 @@ static void backfill_tags(struct transport *transport, struct ref *ref_map)
1112 }
1113
1114 static int do_fetch(struct transport *transport,
1115 - struct refspec_item *refs, int ref_count)
1115 + struct refspec *rs)
1116 {
1117 struct string_list existing_refs = STRING_LIST_INIT_DUP;
1118 struct ref *ref_map;
@@ -1136,7 +1136,7 @@ static int do_fetch(struct transport *transport,
1136 goto cleanup;
1137 }
1138
1139 - ref_map = get_ref_map(transport, refs, ref_count, tags, &autotags);
1139 + ref_map = get_ref_map(transport, rs->items, rs->nr, tags, &autotags);
1140 if (!update_head_ok)
1141 check_not_current_branch(ref_map);
1142
@@ -1160,8 +1160,8 @@ static int do_fetch(struct transport *transport,
1160 * explicitly (via command line or configuration); we
1161 * don't care whether --tags was specified.
1162 */
1163 - if (ref_count) {
1164 - prune_refs(refs, ref_count, ref_map, transport->url);
1163 + if (rs->nr) {
1164 + prune_refs(rs->items, rs->nr, ref_map, transport->url);
1165 } else {
1166 prune_refs(transport->remote->fetch.items,
1167 transport->remote->fetch.nr,
@@ -1410,7 +1410,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv, int pru
1410
1411 sigchain_push_common(unlock_pack_on_signal);
1412 atexit(unlock_pack);
1413 - exit_code = do_fetch(gtransport, rs.items, rs.nr);
1413 + exit_code = do_fetch(gtransport, &rs);
1414 refspec_clear(&rs);
1415 transport_disconnect(gtransport);
1416 gtransport = NULL;