-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from whitecube/pre-commit-hooks
Added pre commit hooks to run pint automatically
- Loading branch information
Showing
4 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# store list of staged files to variable except deleted file since it won't work at re-add | ||
files=$(git diff --name-only --cached --diff-filter=ACMR -- '*.php') | ||
|
||
if [ -n "$files" ]; then | ||
# run pint, this will unstage any files that pint will fix | ||
./vendor/bin/pint $files | ||
|
||
# re-add unstaged files caused by pint back to staging | ||
printf $files | xargs git add | ||
fi |