[PATCH 03/13] transport-helper: factor out push_update_refs_status
From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:49:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
The update ref status part of push is useful for the export command as well, factor it out into it's own function. --- I didn't move the new function up above push_refs_with_push so that it is obvious to the reviewer that the change is trivial. transport-helper.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index 191fbf7..9f2ad00 100644
--- a/transport-helper.c
+++ b/transport-helper.c@@ -554,6 +554,9 @@ static int fetch(struct transport *transport, return -1; } +static void push_update_refs_status(struct helper_data *data, + struct ref *remote_refs); + static int push_refs_with_push(struct transport *transport, struct ref *remote_refs, int flags) {
@@ -609,8 +612,17 @@ static int push_refs_with_push(struct transport *transport, strbuf_addch(&buf, '\n'); sendline(data, &buf); + strbuf_release(&buf); + + push_update_refs_status(data, remote_refs); + return 0; +} - ref = remote_refs; +static void push_update_refs_status(struct helper_data *data, + struct ref *remote_refs) +{ + struct strbuf buf = STRBUF_INIT; + struct ref *ref = remote_refs; while (1) { char *refname, *msg; int status;
@@ -679,7 +691,7 @@ static int push_refs_with_push(struct transport *transport, ref->remote_status = msg; } strbuf_release(&buf); - return 0; + return; } static int push_refs_with_export(struct transport *transport,
--
1.7.2.1.240.g6a95c3