summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorClemens Buchacher <clemens.buchacher@intel.com>2015-11-16 08:05:58 (GMT)
committerJeff King <peff@peff.net>2015-11-16 13:59:19 (GMT)
commitaf65f68cdf7540764583956e5819d85c5f6c74d1 (patch)
treed24339ac5e49e4236682967e331da5cf9ba3f766 /builtin
parentaf40944bda352190f05d22b7cb8fe88beb17f3a7 (diff)
downloadgit-af65f68cdf7540764583956e5819d85c5f6c74d1.zip
git-af65f68cdf7540764583956e5819d85c5f6c74d1.tar.gz
git-af65f68cdf7540764583956e5819d85c5f6c74d1.tar.bz2
allow hooks to ignore their standard input stream
Since ec7dbd145 (receive-pack: allow hooks to ignore its standard input stream) the pre-receive and post-receive hooks ignore SIGPIPE. Do the same for the remaining hooks pre-push and post-rewrite, which read from standard input. The same arguments for ignoring SIGPIPE apply. Include test by Jeff King which checks that SIGPIPE does not cause pre-push hook failure. With the use of git update-ref --stdin it is fast enough to be enabled by default. Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index dca09e2..f2a8b78 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -32,6 +32,7 @@
#include "sequencer.h"
#include "notes-utils.h"
#include "mailmap.h"
+#include "sigchain.h"
static const char * const builtin_commit_usage[] = {
N_("git commit [<options>] [--] <pathspec>..."),
@@ -1537,8 +1538,10 @@ static int run_rewrite_hook(const unsigned char *oldsha1,
return code;
n = snprintf(buf, sizeof(buf), "%s %s\n",
sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
+ sigchain_push(SIGPIPE, SIG_IGN);
write_in_full(proc.in, buf, n);
close(proc.in);
+ sigchain_pop(SIGPIPE);
return finish_command(&proc);
}