git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] Add a generated list of hooks in hook-list.h

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 17, 2021, 10:09 UTC
Message-ID
<cover-0.3-0000000000-20210617T100239Z-avarab@gmail.com>

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/
2. https://lore.kernel.org/git/cover-00.30-00000000000-20210614T101920Z-avarab@gmail.com/
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
Next: Ævar Arnfjörð Bjarmason
Message 1 of 21 in “Add a generated list of hooks in hook-list.h”
  1. 0/3 Add a generated list of hooks in hook-list.hÆvar Arnfjörð Bjarmason, Jun 17, 2021
  2. 1/3 hook.[ch]: move find_hook() to this new libraryÆvar Arnfjörð Bjarmason, Jun 17, 2021
  3. 2/3 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Jun 17, 2021
  4. 3/3 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Jun 17, 2021
  5. SZEDER GáborJun 18, 2021
  6. Eric SunshineJun 18, 2021
  7. Junio C HamanoJun 19, 2021
  8. Ævar Arnfjörð BjarmasonJun 20, 2021
  9. René ScharfeJun 20, 2021
  10. Johannes SchindelinJun 22, 2021
  11. Junio C HamanoJun 29, 2021
  12. René ScharfeJun 29, 2021
  13. 0/3 Add a generated list of hooks in hook-list.hÆvar Arnfjörð Bjarmason, Jun 29, 2021
  14. 1/3 hook.[ch]: move find_hook() to this new libraryÆvar Arnfjörð Bjarmason, Jun 29, 2021
  15. 3/3 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Jun 29, 2021
  16. René ScharfeJun 29, 2021
  17. Ævar Arnfjörð BjarmasonJun 29, 2021
  18. Emily ShafferJul 9, 2021
  19. Ævar Arnfjörð BjarmasonJul 10, 2021
  20. Emily ShafferJul 12, 2021
  21. 2/3 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Jun 29, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.