diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-12-22 04:59:28 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-01-07 15:19:34 -0800 |
| commit | 474c119fda1c323652ccb35124d5c001f48e008a (patch) | |
| tree | 1d266e5b0e449f88795b7b8487c20eb81cbadd72 | |
| parent | hook: add 'run' subcommand (diff) | |
| download | git-474c119fda1c323652ccb35124d5c001f48e008a.tar.gz git-474c119fda1c323652ccb35124d5c001f48e008a.zip | |
hook API: add a run_hooks() wrapper
Add a run_hooks() wrapper, we'll use it in subsequent commits for the
simple cases of wanting to run a single hook under a given name,
without providing options such as "env" or "args".
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>
| -rw-r--r-- | hook.c | 7 | ||||
| -rw-r--r-- | hook.h | 6 |
2 files changed, 13 insertions, 0 deletions
@@ -142,3 +142,10 @@ cleanup: run_hooks_opt_clear(options); return ret; } + +int run_hooks(const char *hook_name) +{ + struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; + + return run_hooks_opt(hook_name, &opt); +} @@ -48,4 +48,10 @@ int hook_exists(const char *hookname); * error(). */ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options); + +/** + * A wrapper for run_hooks_opt() which provides a dummy "struct + * run_hooks_opt" initialized with "RUN_HOOKS_OPT_INIT". + */ +int run_hooks(const char *hook_name); #endif |
