It's cleaner, and will allow us to do something sensible on errors
later.
Signed-off-by: Felipe Contreras <[email protected]>
---
transport-helper.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index 1432a6d..b068ea5 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -733,16 +733,21 @@ static int push_update_ref_status(struct strbuf *buf,
return !(status == REF_STATUS_OK);
}
-static void push_update_refs_status(struct helper_data *data,
+static int push_update_refs_status(struct helper_data *data,
struct ref *remote_refs)
{
struct strbuf buf = STRBUF_INIT;
struct ref *ref = remote_refs;
+ int ret = 0;
+
for (;;) {
char *private;
- if (recvline(data, &buf))
- exit(128);
+ if (recvline(data, &buf)) {
+ ret = 1;
+ break;
+ }
+
if (!buf.len)
break;
@@ -760,6 +765,7 @@ static void push_update_refs_status(struct helper_data
*data,
free(private);
}
strbuf_release(&buf);
+ return ret;
}
static int push_refs_with_push(struct transport *transport,
@@ -840,8 +846,7 @@ static int push_refs_with_push(struct transport *transport,
sendline(data, &buf);
strbuf_release(&buf);
- push_update_refs_status(data, remote_refs);
- return 0;
+ return push_update_refs_status(data, remote_refs);
}
static int push_refs_with_export(struct transport *transport,
@@ -897,8 +902,7 @@ static int push_refs_with_export(struct transport
*transport,
if (finish_command(&exporter))
die("Error while running fast-export");
- push_update_refs_status(data, remote_refs);
- return 0;
+ return push_update_refs_status(data, remote_refs);
}
static int push_refs(struct transport *transport,
--
1.9.1+fc3.9.gc73078e
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html