[PATCH v6 35/40] clone: add 'initial' param to write_remote_refs()
From: Christian Couder <hidden>
Date: 2017-09-16 08:09:08
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- builtin/clone.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index dcd5b878f1..2e5d60521d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c@@ -574,7 +574,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;
@@ -593,8 +593,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);
@@ -641,7 +646,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;
@@ -656,7 +662,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); }
@@ -1168,7 +1174,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.1.576.g3f707d88cd