summaryrefslogtreecommitdiffstats
path: root/git_hooks
diff options
context:
space:
mode:
authorClément DAVID <clement.david@scilab-enterprises.com>2014-04-15 10:21:49 +0200
committerClément DAVID <clement.david@scilab-enterprises.com>2014-04-16 14:55:36 +0200
commit7323535c6abb01c83e090f908ee7b017126bedf3 (patch)
treef714746438688b85ca640c7b512b687260d6c95a /git_hooks
parent5f2c5ca24c0f9535a2f8e19822282ad291b236cf (diff)
downloadscilab-7323535c6abb01c83e090f908ee7b017126bedf3.zip
scilab-7323535c6abb01c83e090f908ee7b017126bedf3.tar.gz
Git pre-commit hook: filter against modified files
Deleted files produced indentation errors Change-Id: I3f0e4ff9c610049124b8a74ef1698af9721a01c7
Diffstat (limited to 'git_hooks')
-rwxr-xr-xgit_hooks/pre-commit8
1 files changed, 4 insertions, 4 deletions
diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit
index 5ba588f..3581740 100755
--- a/git_hooks/pre-commit
+++ b/git_hooks/pre-commit
@@ -100,16 +100,16 @@ indent() {
100 # get the modified files per kind filtering out ignored files and call the 100 # get the modified files per kind filtering out ignored files and call the
101 # __indent_XXX helper 101 # __indent_XXX helper
102 102
103 FILES=$(git diff --cached --name-only $against |grep -E "\.(xcos|xml|xsl)$" |grep -v -F "$XMLINDENT_IGNORED") 103 FILES=$(git diff --cached --name-only --diff-filter=ACM $against |grep -E "\.(xcos|xml|xsl)$" |grep -v -F "$XMLINDENT_IGNORED")
104 [ -z "$FILES" ] || __indent_xml; 104 [ -z "$FILES" ] || __indent_xml;
105 105
106 FILES=$(git diff --cached --name-only $against |grep -E "\.(h|c|hxx|cpp)$" |grep -v -F "$ASTYLE_IGNORED") 106 FILES=$(git diff --cached --name-only --diff-filter=ACM $against |grep -E "\.(h|c|hxx|cpp)$" |grep -v -F "$ASTYLE_IGNORED")
107 [ -z "$FILES" ] || __indent_C; 107 [ -z "$FILES" ] || __indent_C;
108 108
109 FILES=$(git diff --cached --name-only $against |grep -E "\.java$" |grep -v -F "$ASTYLE_IGNORED") 109 FILES=$(git diff --cached --name-only --diff-filter=ACM $against |grep -E "\.java$" |grep -v -F "$ASTYLE_IGNORED")
110 [ -z "$FILES" ] || __indent_java; 110 [ -z "$FILES" ] || __indent_java;
111 111
112 FILES=$(git diff --cached --name-only $against |grep -E "\.(sce|sci|tst)$") 112 FILES=$(git diff --cached --name-only --diff-filter=ACM $against |grep -E "\.(sce|sci|tst)$")
113 [ -z "$FILES" ] || __indent_scilab; 113 [ -z "$FILES" ] || __indent_scilab;
114 114
115 return 0; 115 return 0;