Closed PatchRanger closed 7 years ago
@PatchRanger Good idea to automatically add the files again. Didn't think about that! 👍
@PatchRanger Because #3, when style issues occur, commit is sill is still OK. So the commit is already done, but files are automatically fixed. Don't the files have to added before the commit is made?
Don't the files have to added before the commit is made?
@ceesvanegmond The whole task runs as pre-commit
hook - thus all the things that are being done in it are before commit occurs. Changes in #3 determine which result is being returned - but nevertheless those actions are still before commit occurs. As well as these actions (adding to git). So there shouldn't be any problem.
So there shouldn't be any problem.
@PatchRanger I installed the latest version, and the commit hooks works, but when I got coding style issues, these will automatically be fixed. Then the commit is made, and then the files are added to a 'new' git commit.
What i do now is 'ammend' the commit to automatically append the changes from csfixer to the commit i hadn't pushed yet.
@ceesvanegmond Ah, finally I got the point, thank you for clear example. That shouldn't be so. I pushed a fixing commit to the same branch - attaching a @todo
to it in order to keep in mind that it should be reworked once we get the reason why commit happens before pre-commit hook command is ended. Could you please review it & merge to the master
?
Problem
I want auto-fixed files to be added to the commit.
Reason
It is not handled at all: we just need to add the files at the right moment.
Solution
Here is the proposed change, it works locally. I guess that is how it is intended to work: scan a commit, fix code styling as desired - and finally add these changes to the same commit.