diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-12-22 04:59:31 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-08 00:19:34 +0100 |
commit | ab81cf242c67182911352aeacdd6aabb68a8555c (patch) | |
tree | 29513ef9c8dbdc717405fc081d03d8cff69a74e2 /hook.c | |
parent | am: convert {pre,post}-applypatch to use hook.h (diff) | |
download | git-ab81cf242c67182911352aeacdd6aabb68a8555c.tar.xz git-ab81cf242c67182911352aeacdd6aabb68a8555c.zip |
hook API: add a run_hooks_l() wrapper
Add a run_hooks_l() wrapper, we'll use it in subsequent commits for
the simple cases of wanting to run a single hook under a given name
along with a list of arguments.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hook.c')
-rw-r--r-- | hook.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -149,3 +149,17 @@ int run_hooks(const char *hook_name) return run_hooks_opt(hook_name, &opt); } + +int run_hooks_l(const char *hook_name, ...) +{ + struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; + va_list ap; + const char *arg; + + va_start(ap, hook_name); + while ((arg = va_arg(ap, const char *))) + strvec_push(&opt.args, arg); + va_end(ap); + + return run_hooks_opt(hook_name, &opt); +} |