Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some of the file mgmt logic out of the storage model
[simgrid.git] / tools / git-hooks / clang-format.pre-commit
index 5e19f14..db2e47a 100755 (executable)
@@ -53,7 +53,7 @@ if [ -z $GIT_SUBCOMMAND ] ; then
 fi
 
 # remove any older patches from previous commits. Set to true or false.
-DELETE_OLD_PATCHES=false
+DELETE_OLD_PATCHES=true
 
 # only parse files with the extensions in FILE_EXTS. Set to true or false.
 # if false every changed file in the commit will be parsed with clang-format.
@@ -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 >> "$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"