tests: use "test_hook" for misc "mkdir -p" and "chmod" cases

Make use of "test_hook" in various cases that didn't fit neatly into
preceding commits. Here we need to indent blocks in addition to
changing the test code, or to make other small cosmetic changes.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-03-17 11:13:15 +01:00
committed by Junio C Hamano
parent bef805b7d8
commit c36c62859a
5 changed files with 59 additions and 81 deletions

View File

@ -31,12 +31,9 @@ test_expect_success 'rebase --root fails with too many args' '
'
test_expect_success 'setup pre-rebase hook' '
mkdir -p .git/hooks &&
cat >.git/hooks/pre-rebase <<EOF &&
#!$SHELL_PATH
echo "\$1,\$2" >.git/PRE-REBASE-INPUT
EOF
chmod +x .git/hooks/pre-rebase
test_hook --setup pre-rebase <<-\EOF
echo "$1,$2" >.git/PRE-REBASE-INPUT
EOF
'
cat > expect <<EOF
4
@ -141,12 +138,9 @@ commit work7~5
EOF
test_expect_success 'setup pre-rebase hook that fails' '
mkdir -p .git/hooks &&
cat >.git/hooks/pre-rebase <<EOF &&
#!$SHELL_PATH
false
EOF
chmod +x .git/hooks/pre-rebase
test_hook --setup --clobber pre-rebase <<-\EOF
false
EOF
'
test_expect_success 'pre-rebase hook stops rebase' '