diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-08-13 11:13:28 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-13 10:01:01 -0700 |
| commit | 169c979771158ddc3310f7a1e0e141fd7d0ed088 (patch) | |
| tree | e01728374589fb980fef51ede875399b275a9647 /hook.h | |
| parent | 419dbb29d82b78bcaf0ff22ac7d5db7d1c327575 (diff) | |
| download | git-169c979771158ddc3310f7a1e0e141fd7d0ed088.tar.xz | |
hooks: remove implicit dependency on `the_repository`
We implicitly depend on `the_repository` in our hook subsystem because
we use `strbuf_git_path()` to compute hook paths. Remove this dependency
by accepting a `struct repository` as parameter instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hook.h')
| -rw-r--r-- | hook.h | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -2,6 +2,8 @@ #define HOOK_H #include "strvec.h" +struct repository; + struct run_hooks_opt { /* Environment vars to be set for each hook */ @@ -55,12 +57,12 @@ struct hook_cb_data { * or disabled. Note that this points to static storage that will be * overwritten by further calls to find_hook and run_hook_*. */ -const char *find_hook(const char *name); +const char *find_hook(struct repository *r, const char *name); /** * A boolean version of find_hook() */ -int hook_exists(const char *hookname); +int hook_exists(struct repository *r, const char *hookname); /** * Takes a `hook_name`, resolves it to a path with find_hook(), and @@ -70,13 +72,14 @@ int hook_exists(const char *hookname); * Returns the status code of the run hook, or a negative value on * error(). */ -int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options); +int run_hooks_opt(struct repository *r, 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); +int run_hooks(struct repository *r, const char *hook_name); /** * Like run_hooks(), a wrapper for run_hooks_opt(). @@ -87,5 +90,5 @@ int run_hooks(const char *hook_name); * hook. This function behaves like the old run_hook_le() API. */ LAST_ARG_MUST_BE_NULL -int run_hooks_l(const char *hook_name, ...); +int run_hooks_l(struct repository *r, const char *hook_name, ...); #endif |
