Closed onnimonni closed 9 years ago
One solution would be that we do a trial commit where we clean up everything and test before the actual commit:
e.g.
git commit -n "pre-commit temporary commit" # create a test commit
git stash # gets rid of all unstaged changes
{ run tests }
git reset HEAD~1 # drop the temporary commit
git stash apply # pull back unstaged changes
{ exit with the code from { run tests } and proceed with commit }
I'm just not sure if committing inside a pre-commit script is even possible.
Well we can use The git commit -n flag so ofc it is possible. This just seems really hacky :O
Onni Hakala 0445158280 onni@koodimonni.fi Koodimonni TMI
On Thu, Mar 19, 2015 at 4:53 PM, Antti Kuosmanen notifications@github.com wrote:
One solution would be that we do a trial commit where clean up everything before the actual commit: e.g.
git commit -n "pre-commit temporary commit" # create a test commit git stash # gets rid of all unstaged changes {run tests} git reset HEAD~1 # drop the temporary commit git stash apply # pull back unstaged changes
I'm just not sure if committing inside a pre-commit script is even possible.
Reply to this email directly or view it on GitHub: https://github.com/Seravo/wordpress/issues/4#issuecomment-83614896
When I run
git commit file.php -m "message"
the pre-commit hook tests the state containing all latest files in directory. It should only test head + files_to_be_committed so there won't be any mismatch with the tests and commits.