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

[PATCH v2 0/7] Multiple hook support

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 14, 2019, 00:23 UTC
Message-ID
<20190514002332.121089-1-sandals@crustytoothpaste.net>
This series introduces multiple hook support.

I've thought a lot about the discussion over whether this series should use the configuration as the source for multiple hooks. Ultimately, I've come to the decision that it's not a good idea. Even adopting the empty entry as a reset marker, the fact that inheritance in the configuration is in-order and can't be easily modified means that it's not likely to be very useful, but it is likely to be quite surprising for the average user. I think a solution that sticks with the existing model and builds off a design used by other systems people are familiar with, like cron and run-parts, is going to be a better choice. Moreover, this is the design that people have already built with outside tooling, which is a further argument in favor of it.

I have adopted one configuration-based option, which is the per-hook errorBehavior option that Peff suggested. I think this reduces concerns over what the best error handling strategy is and is a good thing to have as part of a minimum viable product. I picked the names that Peff chose, but if people like different names better, they can be changed.

Just as a preview of what's coming down the line, I plan to build on this series to notify hooks when --quiet and --dry-run options have been specified to commands so that they may honor them if they choose.

Changes from v1:
* Adopted several improvements from Duy's series, including an improved
  find_hooks prototype and a helper function.
* Switched to existence checks instead of executability checks for
  determining whether to invoke multiple hooks.
* Adjusted the commit message for patch 3.
* Added error behavior control using the names Peff provided in his
  comment.
* Added documentation.
brian m. carlson (7):
  run-command: add preliminary support for multiple hooks
  builtin/receive-pack: add support for multiple hooks
  rebase: add support for multiple hooks
  builtin/worktree: add support for multiple post-checkout hooks
  transport: add support for multiple pre-push hooks
  config: allow configuration of multiple hook error behavior
  docs: document multiple hooks
 Documentation/config.txt           |   2 +
 Documentation/config/hook.txt      |  19 ++
 Documentation/githooks.txt         |   9 +
 builtin/am.c                       |  20 +--
 builtin/commit.c                   |   2 +-
 builtin/receive-pack.c             |  78 ++++----
 builtin/worktree.c                 |  44 +++--
 config.c                           |  27 +++
 run-command.c                      | 175 +++++++++++++++---
 run-command.h                      |  22 ++-
 sequencer.c                        |  59 ++++---
 sequencer.h                        |   2 +
 t/lib-hooks.sh                     | 274 +++++++++++++++++++++++++++++
 t/t5403-post-checkout-hook.sh      |   8 +
 t/t5407-post-rewrite-hook.sh       |  15 ++
 t/t5516-fetch-push.sh              |  30 ++++
 t/t5571-pre-push-hook.sh           |  19 ++
 t/t7503-pre-commit-hook.sh         |  15 ++
 t/t7505-prepare-commit-msg-hook.sh |   9 +
 transport.c                        |  29 +--
 20 files changed, 730 insertions(+), 128 deletions(-)
 create mode 100644 Documentation/config/hook.txt
 create mode 100644 t/lib-hooks.sh
Next: brian m. carlson
Message 1 of 34 in “Multiple hook support”
  1. 0/7 Multiple hook supportbrian m. carlson, May 14, 2019
  2. 1/7 run-command: add preliminary support for multiple hooksbrian m. carlson, May 14, 2019
  3. Duy NguyenMay 14, 2019
  4. brian m. carlsonMay 15, 2019
  5. brian m. carlsonMay 29, 2019
  6. Johannes SchindelinMay 14, 2019
  7. brian m. carlsonMay 15, 2019
  8. Johannes SixtMay 16, 2019
  9. Johannes SchindelinMay 17, 2019
  10. 2/7 builtin/receive-pack: add support for multiple hooksbrian m. carlson, May 14, 2019
  11. 3/7 rebase: add support for multiple hooksbrian m. carlson, May 14, 2019
  12. Duy NguyenMay 14, 2019
  13. Johannes SixtMay 14, 2019
  14. brian m. carlsonMay 15, 2019
  15. Duy NguyenMay 16, 2019
  16. 3/7 sequencer: add support for multiple hooksbrian m. carlson, May 14, 2019
  17. 4/7 builtin/worktree: add support for multiple post-checkout hooksbrian m. carlson, May 14, 2019
  18. 5/7 transport: add support for multiple pre-push hooksbrian m. carlson, May 14, 2019
  19. 6/7 config: allow configuration of multiple hook error behaviorbrian m. carlson, May 14, 2019
  20. Duy NguyenMay 14, 2019
  21. brian m. carlsonMay 15, 2019
  22. Jeff KingMay 16, 2019
  23. Jeff KingMay 16, 2019
  24. brian m. carlsonMay 16, 2019
  25. Jeff KingMay 16, 2019
  26. 7/7 docs: document multiple hooksbrian m. carlson, May 14, 2019
  27. Duy NguyenMay 14, 2019
  28. Jonathan NiederMay 14, 2019
  29. brian m. carlsonMay 14, 2019
  30. Jonathan NiederMay 14, 2019
  31. brian m. carlsonMay 16, 2019
  32. Jonathan NiederMay 16, 2019
  33. Jeff KingMay 16, 2019
  34. Duy NguyenMay 14, 2019

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.