3 test_description
='pre-commit hook'
7 test_expect_success
"with no hook" \
10 git commit -m 'first'"
12 test_expect_success
"--no-verify with no hook" \
15 git commit --no-verify -m 'bar'"
17 # now install hook that always succeeds
18 HOOKDIR
="$(git rev-parse --git-dir)/hooks"
19 HOOK
="$HOOKDIR/pre-commit"
27 test_expect_success
"with succeeding hook" \
28 "echo 'more' >> file &&
32 test_expect_success
"--no-verify with succeeding hook" \
33 "echo 'even more' >> file &&
35 git commit --no-verify -m 'even more'"
37 # now a hook that fails
43 test_expect_failure
"with failing hook" \
44 "echo 'another' >> file &&
46 git commit -m 'another'"
48 test_expect_success
"--no-verify with failing hook" \
49 "echo 'stuff' >> file &&
51 git commit --no-verify -m 'stuff'"
54 test_expect_success
"with non-executable hook" \
55 "echo 'content' >> file &&
57 git commit -m 'content'"
59 test_expect_success
"--no-verify with non-executable hook" \
60 "echo 'more content' >> file &&
62 git commit --no-verify -m 'more content'"