Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
git-format: don't fail if there is nothing to do
[simgrid.git] / tools / git-hooks / clang-format.pre-commit
index 9a6678b..db2e47a 100755 (executable)
@@ -149,7 +149,9 @@ do
     #    +++ - timestamp
     # to both lines working on the same file and having a a/ and b/ prefix.
     # Else it can not be applied with 'git apply'.
-    git ${GIT_SUBCOMMAND} --binary ${CLANG_FORMAT} --diff -q "$file" >> "$patch"
+    git ${GIT_SUBCOMMAND} --binary ${CLANG_FORMAT} --diff -q "$file" \
+      | (grep -v "no modified files to format"||true) \
+      >> "$patch"
     #"$CLANG_FORMAT" -style=file "$file" | \
         #diff -u "$file" - | \
         #sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"