[PATCH 03/13] transport-helper: factor out push_update_refs_status
- From
Sverre Rabbelier <srabbelier@gmail.com>
- Date
- Aug 29, 2010, 03:45 UTC
- Message-ID
- <1283053540-27042-4-git-send-email-srabbelier@gmail.com>
- In-Reply-To
- <1283053540-27042-1-git-send-email-srabbelier@gmail.com>
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