Skip to content

Commit 89ea17f

Browse files
committed
t0400: verify that the hook is called correctly from a subdirectory
Suggested by Ben Peart. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent d16546c commit 89ea17f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: t/t0400-pre-command-hook.sh

+23
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,27 @@ test_expect_success 'with failing hook' '
3131
test_path_is_missing "$(cat .git/pre-command.out)"
3232
'
3333

34+
test_expect_success 'in a subdirectory' '
35+
echo touch i-was-here | write_script .git/hooks/pre-command &&
36+
mkdir sub &&
37+
(
38+
cd sub &&
39+
git version
40+
) &&
41+
test_path_is_file sub/i-was-here
42+
'
43+
44+
test_expect_success 'in a subdirectory, using an alias' '
45+
git reset --hard &&
46+
echo "echo \"\$@; \$(pwd)\" >>log" |
47+
write_script .git/hooks/pre-command &&
48+
mkdir -p sub &&
49+
(
50+
cd sub &&
51+
git -c alias.v="version" v
52+
) &&
53+
test_path_is_missing log &&
54+
test_line_count = 2 sub/log
55+
'
56+
3457
test_done

0 commit comments

Comments
 (0)