3 test_description
='pre-commit hook'
7 test_expect_success
'with no hook' '
15 test_expect_success
'--no-verify with no hook' '
19 git commit --no-verify -m "bar"
23 # now install hook that always succeeds
24 HOOKDIR
="$(git rev-parse --git-dir)/hooks"
25 HOOK
="$HOOKDIR/pre-commit"
33 test_expect_success
'with succeeding hook' '
35 echo "more" >> file &&
41 test_expect_success
'--no-verify with succeeding hook' '
43 echo "even more" >> file &&
45 git commit --no-verify -m "even more"
49 # now a hook that fails
55 test_expect_success
'with failing hook' '
57 echo "another" >> file &&
59 test_must_fail git commit -m "another"
63 test_expect_success
'--no-verify with failing hook' '
65 echo "stuff" >> file &&
67 git commit --no-verify -m "stuff"
72 if test "$(git config --bool core.filemode)" = false
; then
73 say
"executable bit not honored - skipping tests of non-executable hook"
76 test_expect_success
'with non-executable hook' '
78 echo "content" >> file &&
80 git commit -m "content"
84 test_expect_success
'--no-verify with non-executable hook' '
86 echo "more content" >> file &&
88 git commit --no-verify -m "more content"
92 fi # non-executable hooks