diff options
| author | Adrian Ratiu <adrian.ratiu@collabora.com> | 2026-02-19 00:23:50 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-19 13:23:41 -0800 |
| commit | d084fa2a915784d65257fbaff43f00b3ea5c8a44 (patch) | |
| tree | a21cc77ed137445de0ff142b3c609a1585f4c643 /t | |
| parent | 1ecce722cdb9c42dd4c69e45e02cb850cd558ef2 (diff) | |
| download | git-d084fa2a915784d65257fbaff43f00b3ea5c8a44.tar.xz | |
hook: allow event = "" to overwrite previous values
Add the ability for empty events to clear previously set multivalue
variables, so the newly added "hook.*.event" behave like the other
multivalued keys.
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t1800-hook.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh index 9797802735..fb6bc554b9 100755 --- a/t/t1800-hook.sh +++ b/t/t1800-hook.sh @@ -226,6 +226,18 @@ test_expect_success 'git hook list reorders on duplicate event declarations' ' test_cmp expected actual ' +test_expect_success 'git hook list: empty event value resets events' ' + setup_hooks && + + # ghi is configured for pre-commit; reset it with an empty value + test_config hook.ghi.event "" --add && + + # only def should remain for pre-commit + echo "def" >expected && + git hook list pre-commit >actual && + test_cmp expected actual +' + test_expect_success 'hook can be configured for multiple events' ' setup_hooks && |
