summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2012-01-20 03:12:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-20 18:14:32 (GMT)
commit5238cbf65638d7a097bdb5ca8226f5acbe31f143 (patch)
tree9514b27b254cd7b641184cc2331e54df6cb6e13c /remote-curl.c
parent04f6785a089e552585ba022f9d9054eca385ca67 (diff)
downloadgit-5238cbf65638d7a097bdb5ca8226f5acbe31f143.zip
git-5238cbf65638d7a097bdb5ca8226f5acbe31f143.tar.gz
git-5238cbf65638d7a097bdb5ca8226f5acbe31f143.tar.bz2
remote-curl: Fix push status report when all branches fail
The protocol between transport-helper.c and remote-curl requires remote-curl to always print a blank line after the push command has run. If the blank line is ommitted, transport-helper kills its container process (the git push the user started) with exit(128) and no message indicating a problem, assuming the helper already printed reasonable error text to the console. However if the remote rejects all branches with "ng" commands in the report-status reply, send-pack terminates with non-zero status, and in turn remote-curl exited with non-zero status before outputting the blank line after the helper status printed by send-pack. No error messages reach the user. This caused users to see the following from git push over HTTP when the remote side's update hook rejected the branch: $ git push http://... master Counting objects: 4, done. Delta compression using up to 6 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 301 bytes, done. Total 3 (delta 0), reused 0 (delta 0) $ Always print a blank line after the send-pack process terminates, ensuring the helper status report (if it was output) will be correctly parsed by the calling transport-helper.c. This ensures the helper doesn't abort before the status report can be shown to the user. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 69831e9..f484859 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -797,7 +797,7 @@ static int push(int nr_spec, char **specs)
static void parse_push(struct strbuf *buf)
{
char **specs = NULL;
- int alloc_spec = 0, nr_spec = 0, i;
+ int alloc_spec = 0, nr_spec = 0, i, ret;
do {
if (!prefixcmp(buf->buf, "push ")) {
@@ -814,12 +814,13 @@ static void parse_push(struct strbuf *buf)
break;
} while (1);
- if (push(nr_spec, specs))
- exit(128); /* error already reported */
-
+ ret = push(nr_spec, specs);
printf("\n");
fflush(stdout);
+ if (ret)
+ exit(128); /* error already reported */
+
free_specs:
for (i = 0; i < nr_spec; i++)
free(specs[i]);