Skip to content

Commit

Permalink
t0400: verify that the hook is called correctly from a subdirectory
Browse files Browse the repository at this point in the history
Suggested by Ben Peart.

Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
  • Loading branch information
dscho committed Aug 16, 2023
1 parent 679487b commit aa36eb9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions t/t0400-pre-command-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,27 @@ test_expect_success 'with failing hook' '
test_path_is_missing "$(cat .git/pre-command.out)"
'

test_expect_success 'in a subdirectory' '
echo touch i-was-here | write_script .git/hooks/pre-command &&
mkdir sub &&
(
cd sub &&
git version
) &&
test_path_is_file sub/i-was-here
'

test_expect_success 'in a subdirectory, using an alias' '
git reset --hard &&
echo "echo \"\$@; \$(pwd)\" >>log" |
write_script .git/hooks/pre-command &&
mkdir -p sub &&
(
cd sub &&
git -c alias.v="version" v
) &&
test_path_is_missing log &&
test_line_count = 2 sub/log
'

test_done

0 comments on commit aa36eb9

Please sign in to comment.