A trivial update to the v4 of the series to migrate hook execution to the new hook.c hook execution library. For a meaningful overall summary see v4's CL[1]. The only update here is to stop using the "env" member of "struct child_process" in favor of "env_array". This is in preparation for a re-roll of another series[2] to remove "argv" (and soon in a re-roll, "env") from that API. Without this update the two would semantically conflict. 1. https://lore.kernel.org/git/cover-v4-00.17-00000000000-20211101T184938Z-avarab@xxxxxxxxx/ 2. https://lore.kernel.org/git/cover-0.5-00000000000-20211122T153605Z-avarab@xxxxxxxxx/ Emily Shaffer (14): hook: add 'run' subcommand gc: use hook library for pre-auto-gc hook am: convert {pre,post}-applypatch to use hook.h rebase: convert pre-rebase to use hook.h am: convert applypatch-msg to use hook.h merge: convert post-merge to use hook.h hooks: convert non-worktree 'post-checkout' hook to hook library hooks: convert worktree 'post-checkout' hook to hook library send-email: use 'git hook run' for 'sendemail-validate' git-p4: use 'git hook' to run hooks commit: convert {pre-commit,prepare-commit-msg} hook to hook.h read-cache: convert post-index-change to use hook.h receive-pack: convert push-to-checkout hook to hook.h run-command: remove old run_hook_{le,ve}() hook API Ævar Arnfjörð Bjarmason (3): hook API: add a run_hooks() wrapper hook API: add a run_hooks_l() wrapper git hook run: add an --ignore-missing flag .gitignore | 1 + Documentation/git-hook.txt | 45 +++++++++++++ Documentation/githooks.txt | 4 ++ Makefile | 1 + builtin.h | 1 + builtin/am.c | 6 +- builtin/checkout.c | 3 +- builtin/clone.c | 3 +- builtin/gc.c | 3 +- builtin/hook.c | 84 +++++++++++++++++++++++ builtin/merge.c | 2 +- builtin/rebase.c | 3 +- builtin/receive-pack.c | 7 +- builtin/worktree.c | 27 +++----- command-list.txt | 1 + commit.c | 15 +++-- git-p4.py | 70 ++----------------- git-send-email.perl | 22 +++--- git.c | 1 + hook.c | 131 ++++++++++++++++++++++++++++++++++++ hook.h | 57 ++++++++++++++++ read-cache.c | 3 +- reset.c | 3 +- run-command.c | 32 --------- run-command.h | 17 ----- t/t1800-hook.sh | 134 +++++++++++++++++++++++++++++++++++++ t/t9001-send-email.sh | 4 +- 27 files changed, 522 insertions(+), 158 deletions(-) create mode 100644 Documentation/git-hook.txt create mode 100644 builtin/hook.c create mode 100755 t/t1800-hook.sh Range-diff against v4: 1: d97d6734961 ! 1: 4ca52feebb8 hook: add 'run' subcommand @@ hook.c: int hook_exists(const char *name) + return 0; + + cp->no_stdin = 1; -+ cp->env = hook_cb->options->env.v; ++ strvec_pushv(&cp->env_array, hook_cb->options->env.v); + cp->stdout_to_stderr = 1; + cp->trace2_hook_name = hook_cb->hook_name; + 2: ca6464f7d5e = 2: 6275b97a306 hook API: add a run_hooks() wrapper 3: 173860afca1 = 3: b5b3051b2e5 gc: use hook library for pre-auto-gc hook 4: 80a2171ddaf = 4: c88eb5d4c25 am: convert {pre,post}-applypatch to use hook.h 5: 74f459db287 = 5: 1d8f7b7e4c1 hook API: add a run_hooks_l() wrapper 6: 1fd70c0e88a = 6: d49a1444345 rebase: convert pre-rebase to use hook.h 7: ccba3ddf52e = 7: 191fdad0165 am: convert applypatch-msg to use hook.h 8: 2c23e8645ec = 8: 119b92fbeae merge: convert post-merge to use hook.h 9: cb95c79093b = 9: 359ba416e84 hooks: convert non-worktree 'post-checkout' hook to hook library 10: f330600fec8 ! 10: b7599be95a7 hooks: convert worktree 'post-checkout' hook to hook library @@ builtin/worktree.c: static int add_worktree(const char *path, const char *refnam ## hook.c ## @@ hook.c: static int pick_next_hook(struct child_process *cp, - cp->env = hook_cb->options->env.v; + strvec_pushv(&cp->env_array, hook_cb->options->env.v); cp->stdout_to_stderr = 1; cp->trace2_hook_name = hook_cb->hook_name; + cp->dir = hook_cb->options->dir; 11: a0b6818c766 = 11: f1c84d7f627 git hook run: add an --ignore-missing flag 12: efa35971e9f = 12: 4e0f94d9102 send-email: use 'git hook run' for 'sendemail-validate' 13: 98e0e3330fb = 13: e858f332a62 git-p4: use 'git hook' to run hooks 14: 79ea5a2a4f5 = 14: 9a5956cc028 commit: convert {pre-commit,prepare-commit-msg} hook to hook.h 15: 81612f94707 = 15: 6fd47c4c499 read-cache: convert post-index-change to use hook.h 16: 43ecd6697e0 = 16: b201ea46f4b receive-pack: convert push-to-checkout hook to hook.h 17: 9ef574fa30c = 17: 281d17b04db run-command: remove old run_hook_{le,ve}() hook API -- 2.34.0.831.gd33babec0d1