Skip the indentation for deleted files 07/7207/2
Sylvestre Ledru [Mon, 21 May 2012 16:20:11 +0000 (18:20 +0200)]
Change-Id: I68bf0c882bc835966bf3f496286d8a299e3f53a1

git_hooks/pre-commit

index 6776f15..f93a2de 100755 (executable)
@@ -87,8 +87,10 @@ indent() {
     fi
 
     # loop on modified files
-    git diff --cached --name-only $against |while read file;
+    git diff --cached --name-status $against |while read st file;
     do
+        # skip deleted files
+        if [ "$st" == 'D' ]; then continue; fi
         local ext=$(expr "$file" : ".*\(\..*\)")
         case $ext in
         .xcos|.xml)