From 2ae335d4d40f7f25c0feff194adc10a8ad9928e4 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 24 Apr 2020 12:26:31 +1200 Subject: [PATCH] Stop clang code formatter checker breaking if local files match glob (flutter/engine#17891) To reproduce: $ touch foo.c foo.cc foo.cpp foo.h foo.m foo.mm $ ./ci/format.sh This will not check any file with clang, as the following command will do a shell expansion and not find anything in git that matches: $ git ls-files *.c *.cc *.cpp *.h *.m *.mm --- engine/src/flutter/ci/format.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/flutter/ci/format.sh b/engine/src/flutter/ci/format.sh index 979cf684f2..ff45d2ad8b 100755 --- a/engine/src/flutter/ci/format.sh +++ b/engine/src/flutter/ci/format.sh @@ -42,7 +42,12 @@ fi; BASE_SHA="$(git fetch $UPSTREAM master > /dev/null 2>&1 && \ (git merge-base --fork-point FETCH_HEAD HEAD || git merge-base FETCH_HEAD HEAD))" +# Disable glob matching otherwise a file in the current directory that matches +# $CLANG_FILETYPES will cause git to query for that exact file instead of doing +# a match. +set -f CLANG_FILES_TO_CHECK="$(git ls-files $CLANG_FILETYPES)" +set +f FAILED_CHECKS=0 for f in $CLANG_FILES_TO_CHECK; do set +e