Skip to content

Commit 5c6812a

Browse files
mjcheethamdscho
authored andcommitted
t0400: verify core.hooksPath is respected by pre-command
Verify that the core.hooksPath configuration is repsected by the pre-command hook. Original regression test was written by Alejandro Pauly. Signed-off-by: Matthew John Cheetham <[email protected]>
1 parent 69d7481 commit 5c6812a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t0400-pre-command-hook.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,15 @@ test_expect_success 'in a subdirectory, using an alias' '
5454
test_line_count = 2 sub/log
5555
'
5656

57+
test_expect_success 'with core.hooksPath' '
58+
mkdir -p .git/alternateHooks &&
59+
write_script .git/alternateHooks/pre-command <<-EOF &&
60+
echo "alternate" >\$(git rev-parse --git-dir)/pre-command.out
61+
EOF
62+
write_script .git/hooks/pre-command <<-EOF &&
63+
echo "original" >\$(git rev-parse --git-dir)/pre-command.out
64+
EOF
65+
git -c core.hooksPath=.git/alternateHooks status &&
66+
test "alternate" = "$(cat .git/pre-command.out)"
67+
'
5768
test_done

0 commit comments

Comments
 (0)