2 ms·
Running on the working tree is mostly okay - just `exit 1` if changes were made and allow the user to stage+commit new changes. It isn't perfect but it doesn't
by a_t48 10mo ago
Running on the working tree is mostly okay - just `exit 1` if changes were made and allow the user to stage+commit new changes. It isn't perfect but it doesn't require checking out a new tree.
- jynelson 10mo agothis completely breaks `git add -p`.
- a_t48 10mo agoYou can either do another `git add -p` after to stage the fixed formatting or do `git add -pn`
- seniorsassycat 10mo agoWhat if I've already fixed the format issue (but not staged it). The pre-commit hook will pass, but it's not doing what the author intended (preventing unformated code from being committed). What if I've only staged one part of a file, but the pre-commit hook fails on the unstaged portions, which should be fine since I'm not commiting or pushing those changes.
- a_t48 10mo agoYou can stash it or `git commit -n`. Perfect is the enemy of good enough.