File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 77# Check for new lines in diff that introduce trailing whitespace.
88
99# We can't run this check unless we know the commit range for the PR.
10+
11+ while getopts " ?" opt; do
12+ case $opt in
13+ ? )
14+ echo " Usage: .lint-whitespace.sh [N]"
15+ echo " TRAVIS_COMMIT_RANGE='<commit range>' .lint-whitespace.sh"
16+ echo " .lint-whitespace.sh -?"
17+ echo " Checks unstaged changes, the previous N commits, or a commit range."
18+ echo " TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' .lint-whitespace.sh"
19+ exit 0
20+ ;;
21+ esac
22+ done
23+
1024if [ -z " ${TRAVIS_COMMIT_RANGE} " ]; then
11- echo " Cannot run lint-whitespace.sh without commit range. To run locally, use: "
12- echo " TRAVIS_COMMIT_RANGE='<commit range>' .lint-whitespace.sh "
13- echo " For example: "
14- echo " TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' .lint-whitespace.sh "
15- exit 1
25+ if [ " $1 " ] ; then
26+ TRAVIS_COMMIT_RANGE=" HEAD~ $1 ...HEAD "
27+ else
28+ TRAVIS_COMMIT_RANGE=" HEAD "
29+ fi
1630fi
1731
1832showdiff () {
You can’t perform that action at this time.
0 commit comments