Last active
May 17, 2016 13:21
-
-
Save smoya/ae32f48d923c5d1f071bb778dae7dea0 to your computer and use it in GitHub Desktop.
Tiny script to run a php cs-fix over a range of commits
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
#!/bin/bash | |
RANGE_COMMITS_FROM_HEAD=$1 | |
SCRIPT=$2 | |
if [ -z "$RANGE_COMMITS_FROM_HEAD" ] | |
then | |
RANGE_COMMITS_FROM_HEAD=1 | |
fi | |
COMMITRANGE="HEAD~$RANGE_COMMITS_FROM_HEAD..HEAD" | |
if [ -z "$SCRIPT" ] | |
then | |
SCRIPT="./bin/php-cs-fixer fix" | |
fi | |
git diff-tree --no-commit-id --name-only -r $COMMITRANGE '*.php' | xargs -L1 --no-run-if-empty $SCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment