From 742118cd1dd25f62fa41dfcc4aecf20f57f2daff Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Wed, 2 Sep 2020 19:43:35 +0200
Subject: [PATCH] Fix format checker

Don't run the format checker in case a file was removed.
---
 cmake/scripts/check-format-1.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmake/scripts/check-format-1.sh b/cmake/scripts/check-format-1.sh
index f4ce7c6016..33b2a5d3b7 100755
--- a/cmake/scripts/check-format-1.sh
+++ b/cmake/scripts/check-format-1.sh
@@ -6,6 +6,12 @@ outfile=$2
 BASE_COMMIT=${FAIRROOT_FORMAT_BASE:-HEAD}
 GIT_CLANG_FORMAT_BIN=${FAIRROOT_GIT_CLANG_FORMAT_BIN:-git-clang-format}
 
+# special case when a file was deleted
+# don't run the test in such a case
+if [ ! -e $infile ]; then 
+  exit 0
+fi
+
 RESULT=$($GIT_CLANG_FORMAT_BIN --commit $BASE_COMMIT --diff $infile --extensions h,hpp,c,C,cpp,cxx,tpl)
 
 if [ "$RESULT" == "no modified files to format" ] || [ "$RESULT" == "clang-format did not modify any files" ]; then
-- 
GitLab