diff --git a/tools/fast8.sh b/tools/fast8.sh index 22976ce09b8..24fab0395fb 100755 --- a/tools/fast8.sh +++ b/tools/fast8.sh @@ -11,15 +11,22 @@ fi echo "Checking last $NUM_COMMITS commits." cd $(dirname "$0")/.. -CHANGED=$(git diff --name-only HEAD~${NUM_COMMITS} | tr '\n' ' ') +CHANGED="" +CHANGED+="$(git diff --name-only HEAD~${NUM_COMMITS} \*.py | tr '\n' ' ')" + +while [[ -z $CHANGED ]]; do + # Search back until we find a commit containing python files + NUM_COMMITS=$((NUM_COMMITS + 1)) + CHANGED+="$(git diff --name-only HEAD~${NUM_COMMITS} \*.py | tr '\n' ' ')" ; +done # Skip files that don't exist # (have been git rm'd) CHECK="" for FILE in $CHANGED; do if [ -f "$FILE" ]; then - CHECK="$CHECK $FILE" + CHECK+="$FILE " fi done -diff -u --from-file /dev/null $CHECK | flake8 --diff +flake8 $CHECK