···8899Test dry-run mode shows what would be created
1010 $ precommit init --dry-run
1111- Would create .git/hooks/
1212- Would create .git/hooks/pre-commit
1313- Would chmod +x .git/hooks/pre-commit
1414- Would create .git/hooks/commit-msg
1515- Would chmod +x .git/hooks/commit-msg
1111+ Would create ./.git/hooks/
1212+ Would create ./.git/hooks/pre-commit
1313+ Would chmod +x ./.git/hooks/pre-commit
1414+ Would create ./.git/hooks/commit-msg
1515+ Would chmod +x ./.git/hooks/commit-msg
1616+ Would create ./.ocamlformat
1717+ .: Would initialise
16181719Test actual init creates the hooks
1820 $ precommit init
1919- Pre-commit hooks initialized successfully.
2121+ .: Initialised
20222123Verify hooks exist and are executable
2224 $ test -x .git/hooks/pre-commit && echo "pre-commit is executable"
···3234Verify commit-msg hook content
3335 $ head -2 .git/hooks/commit-msg
3436 #!/bin/sh
3535- # Check commit message for emojis and remove Claude attribution lines
3737+ # Check commit message for emojis and remove AI attribution lines
36383739Test error when not in a git repo
3840 $ cd /tmp
···4042 $ cd no-git-$$
4143 $ echo '(lang dune 3.0)' > dune-project
4244 $ precommit init
4343- Error: No .git directory found. Run this from a git repository.
4444- [1]
45454646Test error when not in an OCaml project
4747 $ cd /tmp
···4949 $ cd no-dune-$$
5050 $ git init -q
5151 $ precommit init
5252- Error: No dune-project found. Run this from an OCaml project root.
5353- [1]