Subject: Re: [PATCH v5 10/12] hook: move is_known_hook() to hook.c for wider use

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 27 Mar 2026 15:46:41 +0100

On Thu, Mar 26, 2026 at 12:18:17PM +0200, Adrian Ratiu wrote:
> Move is_known_hook() from builtin/hook.c (static) into hook.c and
> export it via hook.h so it can be reused.
> 
> Make it return bool and the iterator `h` for clarity (iterate hooks).
> 
> The next commit will use this to reject hook friendly-names that
> collide with known event names.
> 
> Signed-off-by: Adrian Ratiu <[email-masked]>
> ---
>  Makefile       |  2 +-
>  builtin/hook.c | 10 ----------
>  hook.c         | 10 ++++++++++
>  hook.h         |  6 ++++++
>  4 files changed, 17 insertions(+), 11 deletions(-)

This needs to also be changed in Meson now, as we're adding
"hook-list.h" as a dependency for the builtin sources, not for the
libgit sources. Something like the below patch.

Patrick

diff --git a/meson.build b/meson.build
index 1b0e431d5f..2536ea80ae 100644
--- a/meson.build
+++ b/meson.build
@@ -560,6 +560,18 @@ libgit_sources += custom_target(
   env: script_environment,
 )
 
+libgit_sources += custom_target(
+  input: 'Documentation/githooks.adoc',
+  output: 'hook-list.h',
+  command: [
+    shell,
+    meson.current_source_dir() + '/generate-hooklist.sh',
+    meson.current_source_dir(),
+    '@OUTPUT@',
+  ],
+  env: script_environment,
+)
+
 builtin_sources = [
   'builtin/add.c',
   'builtin/am.c',
@@ -736,18 +748,6 @@ builtin_sources += custom_target(
   env: script_environment,
 )
 
-builtin_sources += custom_target(
-  input: 'Documentation/githooks.adoc',
-  output: 'hook-list.h',
-  command: [
-    shell,
-    meson.current_source_dir() + '/generate-hooklist.sh',
-    meson.current_source_dir(),
-    '@OUTPUT@',
-  ],
-  env: script_environment,
-)
-
 # This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
 # build options to our tests.
 build_options_config = configuration_data()