diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-03-17 13:13:13 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-17 18:40:26 +0300 |
commit | 60a8a6bf6cf2cd7c8c0524c711df50dd5c2ace4f (patch) | |
tree | 2bc1ce029d60132c1b625445d00e4b77cea11ba0 /t/t5601-clone.sh | |
parent | d7ef03681fbcbd0314d91c71d60f79a51338690a (diff) |
tests: change "cat && chmod +x" to use "test_hook"
Refactor various test code to use the "test_hook" helper. This change:
- Fixes the long-standing issues with those tests using "#!/bin/sh"
instead of "#!$SHELL_PATH". Using "#!/bin/sh" here happened to work
because this code was so simple that it e.g. worked on Solaris
/bin/sh.
- Removes the "mkdir .git/hooks" invocation, as explained in a
preceding commit we'll rely on the default templates to create that
directory for us.
For the test in "t5402-post-merge-hook.sh" it's easier and more
correct to unroll the for-loop into a test_expect_success, so let's do
that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5601-clone.sh')
-rwxr-xr-x | t/t5601-clone.sh | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 83c24fc97a..4a61f2c901 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -79,12 +79,10 @@ test_expect_success 'clone from hooks' ' cd .. && git init r1 && cd r1 && - cat >.git/hooks/pre-commit <<-\EOF && - #!/bin/sh + test_hook pre-commit <<-\EOF && git clone ../r0 ../r2 exit 1 EOF - chmod u+x .git/hooks/pre-commit && : >file && git add file && test_must_fail git commit -m invoke-hook && |