aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/dockerfile
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2016-02-09 10:56:25 -0800
committerGravatar murgatroid99 <mlumish@google.com>2016-02-09 10:56:25 -0800
commitf656f189e453c87370caa1cdffa6eed6e71b0f04 (patch)
treed00ef199557acca74512f67619a70b03b29db853 /tools/dockerfile
parenta72a49044beed3e7bb0b7943fdd47afe5d2e9cd3 (diff)
Make sanitize script a suitable pre-commit hook
Diffstat (limited to 'tools/dockerfile')
-rwxr-xr-xtools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
index 86ba8b2e90..dd8ea1ac30 100755
--- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
+++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
@@ -48,6 +48,12 @@ do
done
done
+# The CHANGED_FILES variable is used to restrict the set of files to check.
+# Here we set files to the intersection of files and CHANGED_FILES
+if [ -n "$CHANGED_FILES" ]; then
+ files=$(comm -12 <(echo $files | tr ' ' '\n' | sort -u) <(echo $CHANGED_FILES | tr ' ' '\n' | sort -u))
+fi
+
if [ "x$TEST" = "x" ]
then
echo $files | xargs $CLANG_FORMAT -i