connect, transport: encapsulate arg in struct
In a future patch we plan to return the name of an unborn current branch from deep in the callchain to a caller via a new pointer parameter that points at a variable in the caller when the caller calls get_remote_refs() and transport_get_remote_refs(). In preparation for that, encapsulate the existing ref_prefixes parameter into a struct. The aforementioned unborn current branch will go into this new struct in the future patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
59e1205d16
commit
39835409d1
@ -979,7 +979,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||
int err = 0, complete_refs_before_fetch = 1;
|
||||
int submodule_progress;
|
||||
|
||||
struct strvec ref_prefixes = STRVEC_INIT;
|
||||
struct transport_ls_refs_options transport_ls_refs_options =
|
||||
TRANSPORT_LS_REFS_OPTIONS_INIT;
|
||||
|
||||
packet_trace_identity("clone");
|
||||
|
||||
@ -1257,14 +1258,17 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||
transport->smart_options->check_self_contained_and_connected = 1;
|
||||
|
||||
|
||||
strvec_push(&ref_prefixes, "HEAD");
|
||||
refspec_ref_prefixes(&remote->fetch, &ref_prefixes);
|
||||
strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
|
||||
refspec_ref_prefixes(&remote->fetch,
|
||||
&transport_ls_refs_options.ref_prefixes);
|
||||
if (option_branch)
|
||||
expand_ref_prefix(&ref_prefixes, option_branch);
|
||||
expand_ref_prefix(&transport_ls_refs_options.ref_prefixes,
|
||||
option_branch);
|
||||
if (!option_no_tags)
|
||||
strvec_push(&ref_prefixes, "refs/tags/");
|
||||
strvec_push(&transport_ls_refs_options.ref_prefixes,
|
||||
"refs/tags/");
|
||||
|
||||
refs = transport_get_remote_refs(transport, &ref_prefixes);
|
||||
refs = transport_get_remote_refs(transport, &transport_ls_refs_options);
|
||||
|
||||
if (refs) {
|
||||
int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
|
||||
@ -1380,6 +1384,6 @@ cleanup:
|
||||
strbuf_release(&key);
|
||||
junk_mode = JUNK_LEAVE_ALL;
|
||||
|
||||
strvec_clear(&ref_prefixes);
|
||||
strvec_clear(&transport_ls_refs_options.ref_prefixes);
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user