Add support for submodules.
[git-scripts.git] / check-commit
blob3dc0038576410eb293b5bd5d788f254f99bc4377
1 #!/bin/bash
3 if [ "$1" = "-h" ]; then
4 echo $0': usage: check-commit [<gitref>]'
5 exit 1
6 fi
8 REF=$1
10 if [ -z $REF ]; then
11 REF=HEAD
14 REPOSIT_NAME=`basename $PWD`
16 [ "$REPOSIT_NAME" == "" ] && echo No repository found && exit 1;
18 OWEB="-H -cP -cY -l256"
20 # The copyright pattern to check
21 CPYR=""
23 # Pathnames matching the regexp will be excluded from the test
24 EXCLUDE=""
26 # Source .git-pre-commit hook for user's defined rules
28 [ -f $HOME/.git-pre-commit ] && source $HOME/.git-pre-commit $REPOSIT_NAME
30 mkdir -p /tmp/check-commit
32 git diff --name-only ${REF}^..$REF | \
33 while read file; do
34 bfile=$(basename $file)
35 git show $REF:$file > "/tmp/check-commit/$bfile"
36 style_checker $SC_OPTS -n "$file" "/tmp/check-commit/$bfile"
37 done
39 rm -fr /tmp/check-commit