StyleCheck as pre-commit hook - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: StyleCheck as pre-commit hook (/thread-2076.html) |
StyleCheck as pre-commit hook - xoft - 07-31-2015 The other day I changed the CheckBasicStyle.lua script so that it can check individual files and even the files specifically being committed in Git. This comes handy as a git pre-commit hook - whenever you commit to git, CheckBasicStyle will check your commit before allowing you to actually commit it. To enable: Go to your .git/hooks folder, create a text file "pre-commit" there with the following contents: Code: #!/bin/sh This is all it should take. If you want to disable the checks, just rename / remove the file. I've found one problem so far, but I consider it a highly unlikely scenario: If you edit a file, stage it for commit, then edit it again and finally commit, Git will commit the staged version, while CheckBasicStyle will check the edited version. |