We want to make it possible to separate fetching remote refs into an initial part and a later part. To prepare for that, let's add an 'initial' boolean parameter to write_remote_refs() to tell this function if we are performing the initial part or not. Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- builtin/clone.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/builtin/clone.c b/builtin/clone.c index 4b5340c55f..2362dda880 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -573,7 +573,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs, return local_refs; } -static void write_remote_refs(const struct ref *local_refs) +static void write_remote_refs(const struct ref *local_refs, int initial) { const struct ref *r; @@ -592,8 +592,13 @@ static void write_remote_refs(const struct ref *local_refs) die("%s", err.buf); } - if (initial_ref_transaction_commit(t, &err)) - die("%s", err.buf); + if (initial) { + if (initial_ref_transaction_commit(t, &err)) + die("%s", err.buf); + } else { + if (ref_transaction_commit(t, &err)) + die("%s", err.buf); + } strbuf_release(&err); ref_transaction_free(t); @@ -640,7 +645,8 @@ static void update_remote_refs(const struct ref *refs, const char *branch_top, const char *msg, struct transport *transport, - int check_connectivity) + int check_connectivity, + int initial) { const struct ref *rm = mapped_refs; @@ -655,7 +661,7 @@ static void update_remote_refs(const struct ref *refs, } if (refs) { - write_remote_refs(mapped_refs); + write_remote_refs(mapped_refs, initial); if (option_single_branch && !option_no_tags) write_followtags(refs, msg); } @@ -1164,7 +1170,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix) transport_fetch_refs(transport, mapped_refs); update_remote_refs(refs, mapped_refs, remote_head_points_at, - branch_top.buf, reflog_msg.buf, transport, !is_local); + branch_top.buf, reflog_msg.buf, transport, + !is_local, 0); update_head(our_head_points_at, remote_head, reflog_msg.buf); -- 2.14.0.rc1.52.gf02fb0ddac.dirty