From 26a9884c2a29bd73bba3df733e9b964e521dd6be Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Wed, 15 May 2024 15:37:30 -0400 Subject: [PATCH] Fix fast8 tox env flake8 --diff no longer exists. Change-Id: Idf93686a13cfc40923bc142cad058c97fecf5177 --- tools/fast8.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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