]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
fast8: Skip git rm'd files
authorEric Harney <eharney@redhat.com>
Thu, 19 Nov 2015 21:13:47 +0000 (16:13 -0500)
committerEric Harney <eharney@redhat.com>
Thu, 19 Nov 2015 21:15:40 +0000 (16:15 -0500)
Don't print error messages trying to diff files
that have been removed via git rm.

Change-Id: Ia0945541208fd7a8362843587f797506000479fc

tools/fast8.sh

index 489fc6b3ad87ab121c46de8a640ab82e53108928..c1792ae68bed3e9ee17cc4a5d00b638c4ca15328 100755 (executable)
@@ -2,4 +2,14 @@
 
 cd $(dirname "$0")/..
 CHANGED=$(git diff --name-only HEAD~2 | tr '\n' ' ')
-diff -u --from-file /dev/null $CHANGED | flake8 --diff
+
+# Skip files that don't exist
+# (have been git rm'd)
+CHECK=""
+for FILE in $CHANGED; do
+    if [ -f "$f" ]; then
+        CHECK="$CHECK $FILE"
+    fi
+done
+
+diff -u --from-file /dev/null $CHECK | flake8 --diff