Subject: Re: [PATCH v2 30/30] hook-list.h: add a generated list of hooks, like config-list.h

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 15 Jun 2021 12:02:31 +0200

On Mon, Jun 14 2021, Ævar Arnfjörð Bjarmason wrote:

> Resolve a long-standing TODO item in bugreport.c of there being no
> centralized listing of hooks, this fixes a bug with the bugreport
> listing only knowing about 1/4 of the p4 hooks. It didn't know about
> the "reference-transaction" hook either.
>
> We can now make sure this is kept up-to-date, as the hook.c library
> will die if asked to find a hook we don't know about yet. The only
> (undocumented) exception is the artificial "test-hook" used in our own
> test suite. Move some of the tests away from the "does-not-exist"
> pseudo-hook, and test for the new behavior.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
> ---
>  .gitignore           |  1 +
>  Makefile             | 14 +++++++++++---
>  builtin/bugreport.c  | 44 ++++++++------------------------------------
>  generate-hooklist.sh | 24 ++++++++++++++++++++++++
>  hook.c               | 22 ++++++++++++++++++++++
>  t/t1800-hook.sh      | 14 +++++++++++---
>  6 files changed, 77 insertions(+), 42 deletions(-)
>  create mode 100755 generate-hooklist.sh
>
> diff --git a/.gitignore b/.gitignore
> index de39dc9961b..66189ca3cdc 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -191,6 +191,7 @@
>  /gitweb/static/gitweb.min.*
>  /config-list.h
>  /command-list.h
> +/hook-list.h
>  *.tar.gz
>  *.dsc
>  *.deb
> diff --git a/Makefile b/Makefile
> index a6b71a0fbed..d0532f3c744 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -817,6 +817,7 @@ XDIFF_LIB = xdiff/lib.a
>  
>  GENERATED_H += command-list.h
>  GENERATED_H += config-list.h
> +GENERATED_H += hook-list.h

This fails CI on the Windows boxes (or some of them...) because we hard
rely on cmake there since semi-recently; See 4c2c38e800f (ci:
modification of main.yml to use cmake for vs-build job, 2020-06-26).

Fixing that seems to be a matter of copying some similar boilerplate
around, but I haven't tried.

I was somewhat surprised that cmake support being semi-mandatory seems
to have snuck up on us (or at least on me). The docs in
compat/vcbuild/README still suggest you need make, so perhaps the CI on
Windows could be split up into something that uses "make" and one that
just checks for the cmake compatibility.

It's not that I much prefer the Makefile, but I do think the state of
affairs of needing to duplicate any work of patching the Makefile would
be a step back for me, but maybe the benefit on Windows is so large as
to be worth it...