Skip to content

Commit 474c119

Browse files
avargitster
authored andcommitted
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>
1 parent 96e7225 commit 474c119

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

hook.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,10 @@ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options)
142142
run_hooks_opt_clear(options);
143143
return ret;
144144
}
145+
146+
int run_hooks(const char *hook_name)
147+
{
148+
struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
149+
150+
return run_hooks_opt(hook_name, &opt);
151+
}

hook.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ int hook_exists(const char *hookname);
4848
* error().
4949
*/
5050
int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options);
51+
52+
/**
53+
* A wrapper for run_hooks_opt() which provides a dummy "struct
54+
* run_hooks_opt" initialized with "RUN_HOOKS_OPT_INIT".
55+
*/
56+
int run_hooks(const char *hook_name);
5157
#endif

0 commit comments

Comments
 (0)