Skip to content

Conversation

squirrelito
Copy link

I am finding this as improvement because otherwise if you do commit -a -m "etc" will not stage the modifications before the hook and will not verify contents of the modified files.

@bruli
Copy link
Owner

bruli commented Mar 21, 2016

Travis build is broken. Please fix it.

@squirrelito squirrelito reopened this Mar 22, 2016
@squirrelito
Copy link
Author

Just closed and reopened the PR ... travis broke for some reason marking it as failed build ... all fine now.

The intention here is the following:
I may be wrong or not (probably I do not have the in-depth knowledge about git) but here is what ...
I am committing my changes from PhpStorm which obviously succeeds to git add and commit (not sure if it uses git commit -a -m "etc") while the pre-commit hook doesn't catch the modified but not yet added to the index files and so the hook doesn't execute fixers, phpunit and so on against them.

The change is resulting in a slightly slower exec("git diff --name-only $against", $this->output); but it is working correctly when triggering commit from PhpStorm (haven't tested other GUI git clients like Source Tree etc).

@bruli
Copy link
Owner

bruli commented Apr 10, 2016

I think that I not understand this.

It's a new hook?. In this case, what hook?.

@squirrelito
Copy link
Author

Well, I will try to explain in less lines :)
ExtractCommitedFiles.php would use git diff-index --cached --name-status which would miss changed files when doing git commit -a -m "etc" resulting in no checks against the modified files.
Setting it like git diff --name-only would solve this.

My setup is to use PhpStorm's git client in order to commit and push to a git repo which probably does -a -m for the modified files.

@bruli bruli closed this Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants