Skip to content

use config-based hooks (config-based hooks part II)

Emily Shaffer git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest17 patches 10 repliesIn review
  2. v117 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Renamed 'master' to 'main' in new t5411 (proc-receive) test.
- Removed some accidentally included debug strings.
- Fixed a nasty bug in the reference-transaction hook conversion where calling 'oid_to_hex()' would invalidate references to the output of earlier 'oid_to_hex()' runs farther up the callstack. Instead, the hook callsite now uses 'oid_to_hex_r()'.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17commit: use config-based hooksDocumentation/githooks.txt builtin/commit.c builtin/merge.c +4 more+56 -215 replies
2/17am: convert applypatch hooks to use configDocumentation/githooks.txt builtin/am.c+15 -31 reply
3/17merge: use config-based hooks for post-merge hookDocumentation/githooks.txt builtin/merge.c+6 -10 replies
4/17gc: use hook library for pre-auto-gc hookDocumentation/githooks.txt builtin/gc.c+5 -10 replies
5/17rebase: teach pre-rebase to use hook.hDocumentation/githooks.txt builtin/rebase.c+7 -20 replies
6/17read-cache: convert post-index-change hook to use configDocumentation/githooks.txt read-cache.c+11 -30 replies
7/17receive-pack: convert push-to-checkout hook to hook.hDocumentation/githooks.txt builtin/receive-pack.c+12 -40 replies
8/17git-p4: use 'git hook' to run hooksgit-p4.py+6 -610 replies
9/17hooks: convert 'post-checkout' hook to hook libraryDocumentation/githooks.txt builtin/checkout.c builtin/clone.c +2 more+43 -270 replies
10/17hook: convert 'post-rewrite' hook to configDocumentation/githooks.txt builtin/am.c sequencer.c+36 -600 replies
11/17transport: convert pre-push hook to use configDocumentation/githooks.txt transport.c+14 -430 replies
12/17reference-transaction: look for hooks in configDocumentation/githooks.txt refs.c t/t1416-ref-transaction-hooks.sh+17 -310 replies
13/17receive-pack: convert 'update' hook to hook.hDocumentation/githooks.txt builtin/receive-pack.c t/t1416-ref-transaction-hooks.sh+48 -230 replies
14/17proc-receive: acquire hook list from hook.hDocumentation/githooks.txt builtin/receive-pack.c t/t5411/test-0015-too-many-hooks-error.sh+82 -20 replies
15/17post-update: use hook.h libraryDocumentation/githooks.txt builtin/receive-pack.c+9 -190 replies
16/17receive-pack: convert receive hooks to hook.hDocumentation/githooks.txt builtin/receive-pack.c+94 -1070 replies
17/17run-command: stop thinking about hookshook.c run-command.c run-command.h+37 -920 replies

Reviews trailers per patch

None of the 17 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJosh Steadmon
SeriesR-b
1/17
2/17
3/17
4/17
5/17
6/17
7/17
8/17
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/17] use config-based hooks (config-based hooks part II)

Since v2:
- Renamed 'master' to 'main' in new t5411 (proc-receive) test.
- Removed some accidentally included debug strings.
- Fixed a nasty bug in the reference-transaction hook conversion where calling 'oid_to_hex()' would invalidate references to the output of earlier 'oid_to_hex()' runs farther up the callstack. Instead, the hook callsite now uses 'oid_to_hex_r()'.

Another thing I wanted to do in this series but ended up not having time for before the holidays was to figure out a way to consolidate Documentation/githooks.txt and Documentation/git-hook.txt. My personal preference would be to remove githooks.txt's contents, move the "Hooks" header from there into git-hook.txt, and have 'git help githooks'/'git help hooks' redirect to git-hook.txt; I don't have a patch to share here because I ran out of time before vacation :) What do others envision the documentation looking like?

Thanks!
- Emily

CI run: https://github.com/nasamuffin/git/actions/runs/436905873

Emily Shaffer (17):
commit: use config-based hooks
am: convert applypatch hooks to use config
merge: use config-based hooks for post-merge hook
gc: use hook library for pre-auto-gc hook
rebase: teach pre-rebase to use hook.h
read-cache: convert post-index-change hook to use config
receive-pack: convert push-to-checkout hook to hook.h
git-p4: use 'git hook' to run hooks
hooks: convert 'post-checkout' hook to hook library
hook: convert 'post-rewrite' hook to config
transport: convert pre-push hook to use config
reference-transaction: look for hooks in config
receive-pack: convert 'update' hook to hook.h
proc-receive: acquire hook list from hook.h
post-update: use hook.h library
receive-pack: convert receive hooks to hook.h
run-command: stop thinking about hooks

 Documentation/githooks.txt                    |  45 +++
 builtin/am.c                                  |  30 +-
 builtin/checkout.c                            |  16 +-
 builtin/clone.c                               |   7 +-
 builtin/commit.c                              |  11 +-
 builtin/gc.c                                  |   4 +-
 builtin/merge.c                               |  14 +-
 builtin/rebase.c                              |   7 +-
 builtin/receive-pack.c                        | 326 ++++++++++--------
 builtin/worktree.c                            |  30 +-
 commit.c                                      |  20 +-
 commit.h                                      |   3 +-
 git-p4.py                                     |  67 +---
 hook.c                                        |  39 ++-
 read-cache.c                                  |  12 +-
 refs.c                                        |  38 +-
 reset.c                                       |  15 +-
 run-command.c                                 |  66 ----
 run-command.h                                 |  24 --
 sequencer.c                                   |  83 ++---
 t/t1416-ref-transaction-hooks.sh              |  12 +-
 t/t5411/test-0015-too-many-hooks-error.sh     |  47 +++
 ...3-pre-commit-and-pre-merge-commit-hooks.sh |  17 +-
 transport.c                                   |  55 +--
 24 files changed, 493 insertions(+), 495 deletions(-)
 create mode 100644 t/t5411/test-0015-too-many-hooks-error.sh
Signature · 1 line
2.28.0.rc0.142.g3c755180ce-goog