From 917e0802493a39d77c4bdbdf9aaa5d8d69b7a7b0 Mon Sep 17 00:00:00 2001 From: Emily Shaffer Date: Wed, 8 Feb 2023 20:21:13 +0100 Subject: hook API: support passing stdin to hooks, convert am's 'post-rewrite' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert the invocation of the 'post-rewrite' hook run by 'git am' to use the hook.h library. To do this we need to add a "path_to_stdin" member to "struct run_hooks_opt". In our API this is supported by asking for a file path, rather than by reading stdin. Reading directly from stdin would involve caching the entire stdin (to memory or to disk) once the hook API is made to support "jobs" larger than 1, along with support for executing N hooks at a time (i.e. the upcoming config-based hooks). Signed-off-by: Emily Shaffer Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- hook.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hook.h') diff --git a/hook.h b/hook.h index 4258b13da0..19ab9a5806 100644 --- a/hook.h +++ b/hook.h @@ -30,6 +30,11 @@ struct run_hooks_opt * was invoked. */ int *invoked_hook; + + /** + * Path to file which should be piped to stdin for each hook. + */ + const char *path_to_stdin; }; #define RUN_HOOKS_OPT_INIT { \ -- cgit v1.2.3