Re: [PATCH v5 10/12] hook: move is_known_hook() to hook.c for wider use
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Mar 27, 2026, 15:59 UTC
- Message-ID
- <87v7ehl0uv.fsf@gentoo.mail-host-address-is-not-set>
- In-Reply-To
- <acaYUU4FvEwWTaNu@pks.im>
On Fri, 27 Mar 2026, Patrick Steinhardt <ps@pks.im> wrote:
Show 20 quoted lines
> 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 <adrian.ratiu@collabora.com> >> --- >> 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.
Nice catch, yes, though we might need the generated .h both for the builtin and libgit sources. Will double check this.
I also wonder why meson does not fail ... Likely it's because the builtins are built before libgit.
(the makefile did fail, because I didn't move that dep there as well initially)
Show 42 quoted lines
> 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()
Thanks for the patch, will do something similar in the next re-roll and credit you.
Will wait about 1 week in case there is more feedback.