summaryrefslogtreecommitdiff
path: root/send-pack.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-07 08:39:48 -0500
committerJunio C Hamano <gitster@pobox.com>2017-03-07 14:58:36 -0800
commitd1a13d3fcb252631361a961cb5e2bf10ed467cba (patch)
tree9ab9212d5d9faafacebfa8a48621e49bb306394a /send-pack.c
parentba69f92db6033d6187414c57547e8f79d6aa7f1b (diff)
downloadgit-d1a13d3fcb252631361a961cb5e2bf10ed467cba.tar.gz
send-pack: report signal death of pack-objectsjk/push-deadlock-regression-fix
If our pack-objects sub-process dies of a signal, then it likely didn't have a chance to write anything useful to stderr. The user may be left scratching their head why the push failed. Let's detect this situation and write something to stderr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/send-pack.c b/send-pack.c
index e152327394..d2d2a49a02 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -72,6 +72,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
struct child_process po = CHILD_PROCESS_INIT;
FILE *po_in;
int i;
+ int rc;
i = 4;
if (args->use_thin_pack)
@@ -125,8 +126,20 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
po.out = -1;
}
- if (finish_command(&po))
+ rc = finish_command(&po);
+ if (rc) {
+ /*
+ * For a normal non-zero exit, we assume pack-objects wrote
+ * something useful to stderr. For death by signal, though,
+ * we should mention it to the user. The exception is SIGPIPE
+ * (141), because that's a normal occurence if the remote end
+ * hangs up (and we'll report that by trying to read the unpack
+ * status).
+ */
+ if (rc > 128 && rc != 141)
+ error("pack-objects died of signal %d", rc - 128);
return -1;
+ }
return 0;
}