diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-02-22 14:55:45 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-22 14:55:45 -0800 |
| commit | 5048df67b295baeaaa6dafb16ff712bd2a62731a (patch) | |
| tree | 3c1325ae2d6ddb123323fc30452dd56043e66c51 /hook.c | |
| parent | Merge branch 'ab/various-leak-fixes' (diff) | |
| parent | hook: support a --to-stdin=<path> option (diff) | |
| download | git-5048df67b295baeaaa6dafb16ff712bd2a62731a.tar.gz git-5048df67b295baeaaa6dafb16ff712bd2a62731a.zip | |
Merge branch 'ab/hook-api-with-stdin'
Extend the run-hooks API to allow feeding data from the standard
input when running the hook script(s).
* ab/hook-api-with-stdin:
hook: support a --to-stdin=<path> option
sequencer: use the new hook API for the simpler "post-rewrite" call
hook API: support passing stdin to hooks, convert am's 'post-rewrite'
run-command: allow stdin for run_processes_parallel
run-command.c: remove dead assignment in while-loop
Diffstat (limited to 'hook.c')
| -rw-r--r-- | hook.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -55,6 +55,11 @@ static int pick_next_hook(struct child_process *cp, cp->no_stdin = 1; strvec_pushv(&cp->env, hook_cb->options->env.v); + /* reopen the file for stdin; run_command closes it. */ + if (hook_cb->options->path_to_stdin) { + cp->no_stdin = 0; + cp->in = xopen(hook_cb->options->path_to_stdin, O_RDONLY); + } cp->stdout_to_stderr = 1; cp->trace2_hook_name = hook_cb->hook_name; cp->dir = hook_cb->options->dir; |
