aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hook.c2
-rw-r--r--hook.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/hook.c b/hook.c
index 5ddd7678d1..fde1f88ce8 100644
--- a/hook.c
+++ b/hook.c
@@ -81,7 +81,7 @@ static int pick_next_hook(struct child_process *cp,
cp->in = -1;
}
- cp->stdout_to_stderr = 1;
+ cp->stdout_to_stderr = hook_cb->options->stdout_to_stderr;
cp->trace2_hook_name = hook_cb->hook_name;
cp->dir = hook_cb->options->dir;
diff --git a/hook.h b/hook.h
index 2169d4a6bd..2c8a23a569 100644
--- a/hook.h
+++ b/hook.h
@@ -35,6 +35,15 @@ struct run_hooks_opt
int *invoked_hook;
/**
+ * Send the hook's stdout to stderr.
+ *
+ * This is the default behavior for all hooks except pre-push,
+ * which has separate stdout and stderr streams for backwards
+ * compatibility reasons.
+ */
+ unsigned int stdout_to_stderr:1;
+
+ /**
* Path to file which should be piped to stdin for each hook.
*/
const char *path_to_stdin;
@@ -80,6 +89,7 @@ struct run_hooks_opt
#define RUN_HOOKS_OPT_INIT { \
.env = STRVEC_INIT, \
.args = STRVEC_INIT, \
+ .stdout_to_stderr = 1, \
}
struct hook_cb_data {