From 5f17575575cf21672ca83a09b8378837ff90ec71 Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Sat, 19 Oct 2019 02:41:34 +0300 Subject: [PATCH] Check the format of modified lines only Use the -U0 option to generate a patch that contains only the modified lines without any context --- run-clang-format-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-clang-format-diff.sh b/run-clang-format-diff.sh index a506d0891..512a83bf2 100755 --- a/run-clang-format-diff.sh +++ b/run-clang-format-diff.sh @@ -44,7 +44,7 @@ target=$1 echo "Running code format check between ${target} and ${commit} .." # run clang-format -diff="$(git diff ${target} | clang-format-diff -p1 | python3 -c 'data = open(0).read(); print(data); exit(1 if data else 0)')" +diff="$(git diff -U0 ${target} | clang-format-diff -p1 | python3 -c 'data = open(0).read(); print(data); exit(1 if data else 0)')" # safe return code ret=$?