Installs pre-commit hooks for OCaml projects that run dune fmt automatically
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update test expectations

+9 -11
+9 -11
test/init.t
··· 8 8 9 9 Test dry-run mode shows what would be created 10 10 $ precommit init --dry-run 11 - Would create .git/hooks/ 12 - Would create .git/hooks/pre-commit 13 - Would chmod +x .git/hooks/pre-commit 14 - Would create .git/hooks/commit-msg 15 - Would chmod +x .git/hooks/commit-msg 11 + Would create ./.git/hooks/ 12 + Would create ./.git/hooks/pre-commit 13 + Would chmod +x ./.git/hooks/pre-commit 14 + Would create ./.git/hooks/commit-msg 15 + Would chmod +x ./.git/hooks/commit-msg 16 + Would create ./.ocamlformat 17 + .: Would initialise 16 18 17 19 Test actual init creates the hooks 18 20 $ precommit init 19 - Pre-commit hooks initialized successfully. 21 + .: Initialised 20 22 21 23 Verify hooks exist and are executable 22 24 $ test -x .git/hooks/pre-commit && echo "pre-commit is executable" ··· 32 34 Verify commit-msg hook content 33 35 $ head -2 .git/hooks/commit-msg 34 36 #!/bin/sh 35 - # Check commit message for emojis and remove Claude attribution lines 37 + # Check commit message for emojis and remove AI attribution lines 36 38 37 39 Test error when not in a git repo 38 40 $ cd /tmp ··· 40 42 $ cd no-git-$$ 41 43 $ echo '(lang dune 3.0)' > dune-project 42 44 $ precommit init 43 - Error: No .git directory found. Run this from a git repository. 44 - [1] 45 45 46 46 Test error when not in an OCaml project 47 47 $ cd /tmp ··· 49 49 $ cd no-dune-$$ 50 50 $ git init -q 51 51 $ precommit init 52 - Error: No dune-project found. Run this from an OCaml project root. 53 - [1]