diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-02-05 12:48:48 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-05 13:49:54 -0800 |
commit | 39835409d10de2402c4b3e10dba20286989627d4 (patch) | |
tree | b7517eb09a0c3a2298408ca81ef30d08e7ebf532 /builtin/clone.c | |
parent | ls-refs: report unborn targets of symrefs (diff) | |
download | tgif-39835409d10de2402c4b3e10dba20286989627d4.tar.xz |
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>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index a5630337e4..211d4f54b0 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -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; } |