Skip to content

Commit 53254bf

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 5ab5872 commit 53254bf

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

hook.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ int run_hooks_opt(struct repository *r, const char *hook_name,
158158
.get_next_task = pick_next_hook,
159159
.start_failure = notify_start_failure,
160160
.feed_pipe = options->feed_pipe,
161+
.consume_output = options->consume_output,
161162
.task_finished = notify_hook_finished,
162163

163164
.data = &cb_data,

hook.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ struct run_hooks_opt
8080
* Only useful when using `run_hooks_opt.feed_pipe`, otherwise ignore it.
8181
*/
8282
void *feed_pipe_cb_data;
83+
84+
/*
85+
* Populate this to capture output and prevent it from being printed to
86+
* stderr. This will be passed directly through to
87+
* run_command:run_parallel_processes(). See t/helper/test-run-command.c
88+
* for an example.
89+
*/
90+
consume_output_fn consume_output;
8391
};
8492

8593
#define RUN_HOOKS_OPT_INIT { \

0 commit comments

Comments
 (0)