diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-03-17 11:13:14 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-17 16:40:26 +0100 |
commit | bef805b7d8eed8ab5ee20128acf636a95bcba1f2 (patch) | |
tree | 2ae941a9b1cf89f1fe81ce76b6d1a47151f8f28c /t/t3404-rebase-interactive.sh | |
parent | tests: change "cat && chmod +x" to use "test_hook" (diff) | |
download | git-bef805b7d8eed8ab5ee20128acf636a95bcba1f2.tar.xz git-bef805b7d8eed8ab5ee20128acf636a95bcba1f2.zip |
tests: change "mkdir -p && write_script" to use "test_hook"
Change tests that used a "mkdir -p .git/hooks && write_script" pattern
to use the new "test_hook" helper instead. The new helper does not
create the .git/hooks directory, rather we assume that the default
template will do so for us.
An upcoming series[1] will extend "test_hook" to operate in a
"--template=" mode, but for now assuming that we have a .git/hooks
already is a safe assumption. If that assumption becomes false in the
future we'll only need to change 'test_hook", instead of all of these
callsites.
1. https://lore.kernel.org/git/cover-00.13-00000000000-20211212T201308Z-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3404-rebase-interactive.sh')
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index a38f2da769..f31afd4a54 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -619,9 +619,7 @@ test_expect_success 'rebase a detached HEAD' ' ' test_expect_success 'rebase a commit violating pre-commit' ' - - mkdir -p .git/hooks && - write_script .git/hooks/pre-commit <<-\EOF && + test_hook pre-commit <<-\EOF && test -z "$(git diff --cached --check)" EOF echo "monde! " >> file1 && @@ -636,8 +634,6 @@ test_expect_success 'rebase a commit violating pre-commit' ' ' test_expect_success 'rebase with a file named HEAD in worktree' ' - - rm -fr .git/hooks && git reset --hard && git checkout -b branch3 A && @@ -1688,10 +1684,8 @@ test_expect_success 'valid author header when author contains single quote' ' ' test_expect_success 'post-commit hook is called' ' - test_when_finished "rm -f .git/hooks/post-commit" && >actual && - mkdir -p .git/hooks && - write_script .git/hooks/post-commit <<-\EOS && + test_hook post-commit <<-\EOS && git rev-parse HEAD >>actual EOS ( |