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 /sequencer.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 'sequencer.c')
| -rw-r--r-- | sequencer.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sequencer.c b/sequencer.c index fb23f734ad..65a34f9676 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4844,8 +4844,7 @@ cleanup_head_ref: if (!stat(rebase_path_rewritten_list(), &st) && st.st_size > 0) { struct child_process child = CHILD_PROCESS_INIT; - const char *post_rewrite_hook = - find_hook("post-rewrite"); + struct run_hooks_opt hook_opt = RUN_HOOKS_OPT_INIT; child.in = open(rebase_path_rewritten_list(), O_RDONLY); child.git_cmd = 1; @@ -4855,18 +4854,9 @@ cleanup_head_ref: /* we don't care if this copying failed */ run_command(&child); - if (post_rewrite_hook) { - struct child_process hook = CHILD_PROCESS_INIT; - - hook.in = open(rebase_path_rewritten_list(), - O_RDONLY); - hook.stdout_to_stderr = 1; - hook.trace2_hook_name = "post-rewrite"; - strvec_push(&hook.args, post_rewrite_hook); - strvec_push(&hook.args, "rebase"); - /* we don't care if this hook failed */ - run_command(&hook); - } + hook_opt.path_to_stdin = rebase_path_rewritten_list(); + strvec_push(&hook_opt.args, "rebase"); + run_hooks_opt("post-rewrite", &hook_opt); } apply_autostash(rebase_path_autostash()); |
