File: prepare-commit-msg

package info (click to toggle)
scilab 6.1.0+dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 373,664 kB
  • sloc: xml: 800,046; cpp: 278,515; ansic: 223,487; java: 191,492; fortran: 91,481; ml: 23,103; tcl: 16,853; sh: 10,897; makefile: 9,608; lex: 1,611; perl: 1,566; yacc: 1,264; php: 690; cs: 614; javascript: 50
file content (32 lines) | stat: -rwxr-xr-x 879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
# Hook used to produce a commit message based on CHANGES
#

FILE="$1"
SOURCE="$2"
COMMIT="$3"

case $SOURCE in
    'merge')
        # On merges adds the commit messages found in CHANGES
        TMP=`mktemp 2> /dev/null || mktemp -t 'mytmpdir'` && \
            cat $FILE >$TMP && \
            sed -i '/^Merge.*/d' $TMP && \
            git diff --cached scilab/CHANGES* |sed -n '/^+/p' |sed -n '/^+++/!p' |sed 's/^.\{1\}//g' >$FILE && \
            cat $TMP >>$FILE && \
            rm $TMP
        ;;

    '')
        # On normal commit add messages found in CHANGES
        TMP=`mktemp 2> /dev/null || mktemp -t 'mytmpdir'` && \
            cat $FILE >$TMP && \
            git diff --cached scilab/CHANGES* |sed -n '/^+/p' |sed -n '/^+++/!p' |sed 's/^.\{1\}//g' >$FILE && \
            cat $TMP >>$FILE && \
            rm $TMP
        ;;
    *)
        ;;
esac