summaryrefslogtreecommitdiffstats
path: root/git_hooks
diff options
context:
space:
mode:
authorAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-11-13 12:04:44 +0100
committerAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-11-13 14:03:36 +0100
commitba0902ab6a77ca532086b5b4f27d67489be4b814 (patch)
tree3bdaf3c398f4f32dffb1fc14e017f8a98bd0a729 /git_hooks
parenta7015d45ff3ac2f10c1564d14fb0f6669478a806 (diff)
parenta53c2c4f46b1ea42d908b751310cb6bd92b7a870 (diff)
downloadscilab-windows.zip
scilab-windows.tar.gz
Merge remote-tracking branch 'origin/master' into windowswindows
Change-Id: I80edbceb67381ca1af2b19ef82ee08fc5b385909
Diffstat (limited to 'git_hooks')
-rwxr-xr-xgit_hooks/pre-commit13
-rwxr-xr-xgit_hooks/prepare-commit-msg29
2 files changed, 31 insertions, 11 deletions
diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit
index 6ffc063..3de975b 100755
--- a/git_hooks/pre-commit
+++ b/git_hooks/pre-commit
@@ -19,7 +19,10 @@ fi
19# 19#
20# Configuration check 20# Configuration check
21# 21#
22XMLINDENT="$(git config --get hooks.xmlindent)" 22if test ! -x "$XMLINDENT"
23then
24 XMLINDENT="$(git config --get hooks.xmlindent)"
25fi
23if test ! -x "$XMLINDENT" 26if test ! -x "$XMLINDENT"
24then 27then
25 echo "Unable to find xmlindent executable on the configuration." 28 echo "Unable to find xmlindent executable on the configuration."
@@ -45,7 +48,10 @@ else
45 XMLINDENT_IGNORED="$(find $(git config --get-all xmlindent.ignored))" 48 XMLINDENT_IGNORED="$(find $(git config --get-all xmlindent.ignored))"
46fi 49fi
47 50
48ASTYLE="$(git config --get hooks.astyle)" 51if test ! -x "$ASTYLE"
52then
53 ASTYLE="$(git config --get hooks.astyle)"
54fi
49if test ! -x "$ASTYLE" 55if test ! -x "$ASTYLE"
50then 56then
51 echo "Unable to find astyle executable on the configuration." 57 echo "Unable to find astyle executable on the configuration."
@@ -128,6 +134,9 @@ __indent_xml() {
128 134
129 echo "Formatting" "$FILES" 135 echo "Formatting" "$FILES"
130 "$XMLINDENT" -w -i 4 $FILES || return 2; 136 "$XMLINDENT" -w -i 4 $FILES || return 2;
137 # xmlindent does not remove trailing whitespaces
138 # and might add some on empty lines
139 sed -i -e 's/[ \t]*$//' $FILES || return 2;
131 git add $FILES || return 3; 140 git add $FILES || return 3;
132} 141}
133 142
diff --git a/git_hooks/prepare-commit-msg b/git_hooks/prepare-commit-msg
index 78a6f23..050e17c 100755
--- a/git_hooks/prepare-commit-msg
+++ b/git_hooks/prepare-commit-msg
@@ -8,14 +8,25 @@ SOURCE="$2"
8COMMIT="$3" 8COMMIT="$3"
9 9
10case $SOURCE in 10case $SOURCE in
11'') 11 'merge')
12 TMP=`mktemp 2> /dev/null || mktemp -t 'mytmpdir'` && \ 12 # On merges adds the commit messages found in CHANGES
13 cat $FILE >$TMP && \ 13 TMP=`mktemp 2> /dev/null || mktemp -t 'mytmpdir'` && \
14 git diff --cached scilab/CHANGES_* |sed -n '/^+/p' |sed -n '/^+++/!p' |sed 's/^.\{1\}//g' >$FILE && \ 14 cat $FILE >$TMP && \
15 cat $TMP >>$FILE && \ 15 sed -i '/^Merge.*/d' $TMP && \
16 rm $TMP 16 git diff --cached scilab/CHANGES* |sed -n '/^+/p' |sed -n '/^+++/!p' |sed 's/^.\{1\}//g' >$FILE && \
17 ;; 17 cat $TMP >>$FILE && \
18*) 18 rm $TMP
19 ;; 19 ;;
20
21 '')
22 # On normal commit add messages found in CHANGES
23 TMP=`mktemp 2> /dev/null || mktemp -t 'mytmpdir'` && \
24 cat $FILE >$TMP && \
25 git diff --cached scilab/CHANGES* |sed -n '/^+/p' |sed -n '/^+++/!p' |sed 's/^.\{1\}//g' >$FILE && \
26 cat $TMP >>$FILE && \
27 rm $TMP
28 ;;
29 *)
30 ;;
20esac 31esac
21 32