diff options
author | Igor Wiedler <igor@wiedler.ch> | 2010-06-22 16:42:29 +0200 |
---|---|---|
committer | Chris Smith <toonarmy@phpbb.com> | 2010-07-12 02:04:29 +0100 |
commit | 6b2f4b6a850493fa0277ae38ee816d7c5a3a2311 (patch) | |
tree | 4d0a8c733f361b638371d75c2790c92f035006d6 | |
parent | f0509e4620643549caa7a486d54b12d53617ab94 (diff) | |
download | forums-6b2f4b6a850493fa0277ae38ee816d7c5a3a2311.tar forums-6b2f4b6a850493fa0277ae38ee816d7c5a3a2311.tar.gz forums-6b2f4b6a850493fa0277ae38ee816d7c5a3a2311.tar.bz2 forums-6b2f4b6a850493fa0277ae38ee816d7c5a3a2311.tar.xz forums-6b2f4b6a850493fa0277ae38ee816d7c5a3a2311.zip |
[task/git-tools] move ticket id appending to commit-msg hook
PHPBB3-9770
-rwxr-xr-x | git-tools/hooks/commit-msg | 24 | ||||
-rwxr-xr-x | git-tools/hooks/prepare-commit-msg | 7 |
2 files changed, 24 insertions, 7 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg new file mode 100755 index 0000000000..db31d93698 --- /dev/null +++ b/git-tools/hooks/commit-msg @@ -0,0 +1,24 @@ +#!/bin/sh +# +# A hook to append PHPBB3-<ticket_id> to ticket/<ticket_id> +# branches. +# +# This is a commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/commit-msg \\ +# .git/hooks/commit-msg + +if grep '^\[ticket/' "$1" +then + # get branch name + branch="$(git symbolic-ref HEAD)" + + # strip off refs/heads/ticket + ticket_id="$(echo "$branch" | sed "s/refs\/heads\/ticket\///g")" + + echo >> "$1" + echo "PHPBB3-$ticket_id" >> "$1" +fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index ab01f49b5a..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -32,10 +32,3 @@ if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi - -if (echo $branch | grep '^ticket/') -then - ticket_id="$(echo $branch | sed "s/ticket\///g")" - echo >> "$1" - echo "PHPBB3-$ticket_id" >> "$1" -fi |