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 370a233d22..bd690576e6 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -572,7 +572,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; @@ -591,8 +591,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); @@ -639,7 +644,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; @@ -654,7 +660,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); } @@ -1163,7 +1169,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.13.1.565.gbfcd7a9048