diff options
author | Nils Adermann <naderman@naderman.de> | 2010-04-04 15:04:28 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-04-04 15:04:28 +0200 |
commit | fa9510be23e76b8729e2ea16fc0e8403c7a3643c (patch) | |
tree | 19d0854ef685aa35b2013de58a3a80d9fb8bc5c2 /git-tools/hooks/prepare-commit-msg | |
parent | 43774ef423d205250181c7413585ecd4d9ad6388 (diff) | |
parent | 11de6a46b10c5bdb77b2ee7f9e970b849e0f4d74 (diff) | |
download | forums-fa9510be23e76b8729e2ea16fc0e8403c7a3643c.tar forums-fa9510be23e76b8729e2ea16fc0e8403c7a3643c.tar.gz forums-fa9510be23e76b8729e2ea16fc0e8403c7a3643c.tar.bz2 forums-fa9510be23e76b8729e2ea16fc0e8403c7a3643c.tar.xz forums-fa9510be23e76b8729e2ea16fc0e8403c7a3643c.zip |
Merge branch 'feature/evil3/git-tools' into develop-olympus
* feature/evil3/git-tools:
[git-tools] add note about PHP_BIN using env
[git-tools] do not display stderr
[git-tools] Prepend the branch to the commit message for all branches.
[git-tools] Use env to find the correct paths to binaries.
[git-tools] Display what parse errors were found.
[git-tools] This script requires bash to run, so point directly to bash.
[git-tools] Improvements for the pre-commit hook
[git-tools] Improvements on prepare-commt-msg hook
[git-tools] Some pre-commit enhancements, abolish tempfile
[git-tools] use mktemp in pre-commit (thanks nn-)
[git-tools] pre-commit hook for syntax checking
Diffstat (limited to 'git-tools/hooks/prepare-commit-msg')
-rwxr-xr-x | git-tools/hooks/prepare-commit-msg | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index e1e05d67b8..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -10,15 +10,25 @@ # # ln -s ../../git-tools/hooks/prepare-commit-msg \\ # .git/hooks/prepare-commit-msg -# -# Make sure it is executable. -# strip off ref: refs/heads/ -branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')" +# get branch name +branch="$(git symbolic-ref HEAD)" + +# exit if no branch name is present +# (eg. detached HEAD) +if [ $? -ne 0 ] +then + exit +fi + +# strip off refs/heads/ +branch="$(echo "$branch" | sed "s/refs\/heads\///g")" +# add [branchname] to commit message # * only run when normal commit is made (without -m or -F; # not a merge, etc.) # * also make sure the branch name begins with bug/ or feature/ -if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^\(bug\|feature\)/') ]; then - echo "[$branch] $(cat $1)" > "$1" +if [ "$2" = "" ] +then + echo "[$branch] $(cat "$1")" > "$1" fi |