git/templates
Robin Jarry 3c8d3adeae send-email: export patch counters in validate environment
When sending patch series (with a cover-letter or not)
sendemail-validate is called with every email/patch file independently
from the others. When one of the patches depends on a previous one, it
may not be possible to use this hook in a meaningful way. A hook that
wants to check some property of the whole series needs to know which
patch is the final one.

Expose the current and total number of patches to the hook via the
GIT_SENDEMAIL_PATCH_COUNTER and GIT_SENDEMAIL_PATCH_TOTAL environment
variables so that both incremental and global validation is possible.

Sharing any other state between successive invocations of the validate
hook must be done via external means. For example, by storing it in
a git config sendemail.validateWorktree entry.

Add a sample script with placeholder validations and update tests to
check that the counters are properly exported.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-04-14 10:41:15 -07:00
..
.gitignore
branches--
hooks--applypatch-msg.sample
hooks--commit-msg.sample
hooks--fsmonitor-watchman.sample
hooks--post-update.sample
hooks--pre-applypatch.sample
hooks--pre-commit.sample
hooks--pre-merge-commit.sample
hooks--pre-push.sample
hooks--pre-rebase.sample
hooks--pre-receive.sample
hooks--prepare-commit-msg.sample
hooks--push-to-checkout.sample
hooks--sendemail-validate.sample send-email: export patch counters in validate environment 2023-04-14 10:41:15 -07:00
hooks--update.sample
info--exclude
Makefile
this--description