Hi,

As Mike raised my attention, I'm sloppy in that, so I decided to integrate it 
with my git wrapper.
It is a shell script in my home directory which precedes git so I can enforce 
stuff not configurable for git.
git hooks can do similar stuff, but they have to be created for each 
repository, while this works on all of them.

$ cat ~/bin/git
#!/bin/sh

command=$1
shift

case $command in
    *clean)
        # don't clean out Eclipse settings
        /usr/bin/git $command -e .cproject -e .project -e .settings "$@"
        ;;
    *commit)
        # if there is checkpatch, don't allow commit when it fails
        if [ -e scripts/checkpatch.pl ]; then
                /usr/bin/git diff --cached | scripts/checkpatch.pl --no-signoff 
-q -
                if [ $? -ne 0 ]; then
                        exit
                fi
        fi
        /usr/bin/git $command "$@"
        if [ $? -ne 0 ]; then
                exit
        fi
        # run checkpatch again to look at the commit message
        if [ -e scripts/checkpatch.pl ]; then
                /usr/bin/git format-patch -1 --stdout | scripts/checkpatch.pl 
--no-signoff -q -
        fi
        ;;
    *)
        /usr/bin/git $command "$@"
        ;;
esac
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to