Skip to content

Commit fedcd93

Browse files
nasamuffingitster
authored andcommitted
hooks: allow callers to capture output
Some server-side hooks will require capturing output to send over sideband instead of printing directly to stderr. Expose that capability. Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bdf49ba commit fedcd93

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

hook.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ int run_hooks_opt(struct repository *r, const char *hook_name,
152152
.get_next_task = pick_next_hook,
153153
.start_failure = notify_start_failure,
154154
.feed_pipe = options->feed_pipe,
155+
.consume_sideband = options->consume_sideband,
155156
.task_finished = notify_hook_finished,
156157

157158
.data = &cb_data,

hook.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ struct run_hooks_opt
6565
* Only useful when using run_hooks_opt.feed_pipe, otherwise ignore it.
6666
*/
6767
void *feed_pipe_cb_data;
68+
69+
/*
70+
* Populate this to capture output and prevent it from being printed to
71+
* stderr. This will be passed directly through to
72+
* run_command:run_parallel_processes(). See t/helper/test-run-command.c
73+
* for an example.
74+
*/
75+
consume_sideband_fn consume_sideband;
6876
};
6977

7078
#define RUN_HOOKS_OPT_INIT { \

0 commit comments

Comments
 (0)