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 test_expect_success POSIXPERM 'with non-executable hook' '
74 echo "content" >> file &&
76 git commit -m "content"
80 test_expect_success POSIXPERM '--no-verify with non-executable hook' '
82 echo "more content" >> file &&
84 git commit --no-verify -m "more content"