[PATCH 0/3] Add a generated list of hooks in hook-list.h
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-06-17 10:09:41
This goes on top of my just-submitted trivial Makefile fixes[1], and
adds a list of hooks in hook-list.h, similar to the existing
config-list.h.
We can then error when a C API provides us with an unknown hook, so
non-type-checked things in the codebase like find_hook("proc-receive")
now effectively have a type check of sorts (well, we'd catch a typo in
our tests).
These changes are currently at the end of the
ab/config-based-hooks-base series[2], I'm carving them out to make
that topic even easier to digest. We can this without any of the "git
hook run" stuff.
We also had a big but inaccurate list of hooks in builtin/help.c, as
part of submitting a bugreport. That's now using githooks(5) as a
source of truth.
This also builds on Windows with cmake, unlike the outstanding [2]
`restart of "config-based-hooks"` series, at least that part of the CI
now passes, and the change to contrib/buildsystems/CMakeLists.txt
looks trivially correct to me.
1. https://lore.kernel.org/git/cover-0.3-0000000000-20210617T095827Z-avarab@gmail.com/ (local)
2. https://lore.kernel.org/git/cover-00.30-00000000000-20210614T101920Z-avarab@gmail.com/ (local)
Emily Shaffer (1):
hook.c: add a hook_exists() wrapper and use it in bugreport.c
Ævar Arnfjörð Bjarmason (2):
hook.[ch]: move find_hook() to this new library
hook-list.h: add a generated list of hooks, like config-list.h
.gitignore | 1 +
Makefile | 12 +++++-
builtin/am.c | 1 +
builtin/bugreport.c | 46 +++++-----------------
builtin/commit.c | 1 +
builtin/merge.c | 1 +
builtin/receive-pack.c | 1 +
builtin/worktree.c | 1 +
contrib/buildsystems/CMakeLists.txt | 7 ++++
generate-hooklist.sh | 24 ++++++++++++
hook.c | 61 +++++++++++++++++++++++++++++
hook.h | 16 ++++++++
refs.c | 1 +
run-command.c | 35 +----------------
run-command.h | 7 ----
sequencer.c | 1 +
transport.c | 1 +
17 files changed, 138 insertions(+), 79 deletions(-)
create mode 100755 generate-hooklist.sh
create mode 100644 hook.c
create mode 100644 hook.h
--
2.32.0.576.g59759b6ca7d