t0400: verify that the hook is called correctly from a subdirectory

Suggested by Ben Peart.

Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
This commit is contained in:
Johannes Schindelin 2017-03-16 21:07:54 +01:00 коммит произвёл Johannes Schindelin
Родитель c4ec7f1f70
Коммит 49fc7fae6c
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -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