RFC configuration-based hook management (was: [TOPIC 2/17] Hooks in the future)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 RFC Latest2 patches 11 repliesIn review
- v16 patches 12 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | hook: scaffolding for git-hook subcommand.gitignore Documentation/ Makefile +4 more | +55 | 0 replies | |
| 2/2 | hook: add --list modeDocumentation/ Makefile builtin/ +3 more | +249 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [RFC PATCH v2 0/2] configuration-based hook management (was: [TOPIC 2/17] Hooks in the future)
Not much to look at compared to the original RFC I sent some months ago. This implements Peff's suggestion of using the "hookcmd" section as a layer of indirection. The scope is a little smaller than the original RFC as it doesn't have a way to remove hooks from downstream (yet), and ordering numbers are dropped (for now).
One thing that's missing, as evidenced by the TODO, is a way to handle arbitrary options given within a "hookcmd" unit. I think this can be achieved with a callback, since it seems plausible that "pre-receive" might want a different set of options than "post-commit" or so on. To me, it sounds achievable with a callback; I imagine a follow-on teaching git-hook how to remove a hook with something like "hookcmd.foo.skip = true" will give an OK indication of how that might look.
Overall though, I think this is simpler than the first version of the RFC because I was reminded by wiser folks than I to "keep it simple, stupid." ;)
I think it's feasible that with these couple patches applied, someone who wanted to jump in early could replace their .git/hook/whatever-hookname with some boilerplate like
xargs -n 1 'sh -c' <<<"$(git hook --list whatever-hookname)"
and give it a shot. Untested snippet. :)
CI run: https://github.com/gitgitgadget/git/pull/611/checks
- Emily
Emily Shaffer (2):
hook: scaffolding for git-hook subcommand
hook: add --list mode
.gitignore | 1 + Documentation/git-hook.txt | 53 ++++++++++++++++++++ Makefile | 2 + builtin.h | 1 + builtin/hook.c | 77 +++++++++++++++++++++++++++++ git.c | 1 + hook.c | 92 +++++++++++++++++++++++++++++++++++ hook.h | 13 +++++ t/t1360-config-based-hooks.sh | 58 ++++++++++++++++++++++ 9 files changed, 298 insertions(+) create mode 100644 Documentation/git-hook.txt create mode 100644 builtin/hook.c create mode 100644 hook.c create mode 100644 hook.h create mode 100755 t/t1360-config-based-hooks.sh
Signature · 1 line
2.26.0.110.g2183baf09c-goog