Skip to content

Commit 0551a06

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5931b33 commit 0551a06

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

transport-helper.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,17 +739,22 @@ static int push_update_ref_status(struct strbuf *buf,
739739
return !(status == REF_STATUS_OK);
740740
}
741741

742-
static void push_update_refs_status(struct helper_data *data,
742+
static int push_update_refs_status(struct helper_data *data,
743743
struct ref *remote_refs,
744744
int flags)
745745
{
746746
struct strbuf buf = STRBUF_INIT;
747747
struct ref *ref = remote_refs;
748+
int ret = 0;
749+
748750
for (;;) {
749751
char *private;
750752

751-
if (recvline(data, &buf))
752-
exit(128);
753+
if (recvline(data, &buf)) {
754+
ret = 1;
755+
break;
756+
}
757+
753758
if (!buf.len)
754759
break;
755760

@@ -767,6 +772,7 @@ static void push_update_refs_status(struct helper_data *data,
767772
free(private);
768773
}
769774
strbuf_release(&buf);
775+
return ret;
770776
}
771777

772778
static int push_refs_with_push(struct transport *transport,
@@ -847,8 +853,7 @@ static int push_refs_with_push(struct transport *transport,
847853
sendline(data, &buf);
848854
strbuf_release(&buf);
849855

850-
push_update_refs_status(data, remote_refs, flags);
851-
return 0;
856+
return push_update_refs_status(data, remote_refs, flags);
852857
}
853858

854859
static int push_refs_with_export(struct transport *transport,
@@ -906,8 +911,7 @@ static int push_refs_with_export(struct transport *transport,
906911

907912
if (finish_command(&exporter))
908913
die("Error while running fast-export");
909-
push_update_refs_status(data, remote_refs, flags);
910-
return 0;
914+
return push_update_refs_status(data, remote_refs, flags);
911915
}
912916

913917
static int push_refs(struct transport *transport,

0 commit comments

Comments
 (0)