summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2014-04-12 15:33:30 -0500
committerJunio C Hamano <gitster@pobox.com>2014-04-14 13:51:37 -0700
commit0551a06c22543d4ff1aecbdf6b419760b1b10bff (patch)
tree12acbf7512b70a7807e08dc5d552ad72dfffb86b /transport-helper.c
parent5931b33e202856aa0046b493c3aacdd16be7d8f3 (diff)
downloadgit-0551a06c22543d4ff1aecbdf6b419760b1b10bff.tar.gz
transport-helper: propagate recvline() error pushing
It's cleaner, and will allow us to do something sensible on errors later. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/transport-helper.c b/transport-helper.c
index f0d7fc772c..e91bc9af89 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -739,17 +739,22 @@ 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,
int flags)
{
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;
@@ -767,6 +772,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,
@@ -847,8 +853,7 @@ static int push_refs_with_push(struct transport *transport,
sendline(data, &buf);
strbuf_release(&buf);
- push_update_refs_status(data, remote_refs, flags);
- return 0;
+ return push_update_refs_status(data, remote_refs, flags);
}
static int push_refs_with_export(struct transport *transport,
@@ -906,8 +911,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, flags);
- return 0;
+ return push_update_refs_status(data, remote_refs, flags);
}
static int push_refs(struct transport *transport,