diff options
author | Chris Smith <toonarmy@phpbb.com> | 2010-07-08 00:27:45 +0100 |
---|---|---|
committer | Chris Smith <toonarmy@phpbb.com> | 2010-08-10 14:48:40 +0100 |
commit | bfa7b287344462bbd6f8a0f02810f7a6b225f65a (patch) | |
tree | 9b52a8c9f343270b1fdf822fcc9bc68be296c626 /git-tools/hooks | |
parent | 14e5da90c3d84cb089e1df4d7a0ac7a34a0fbeba (diff) | |
download | forums-bfa7b287344462bbd6f8a0f02810f7a6b225f65a.tar forums-bfa7b287344462bbd6f8a0f02810f7a6b225f65a.tar.gz forums-bfa7b287344462bbd6f8a0f02810f7a6b225f65a.tar.bz2 forums-bfa7b287344462bbd6f8a0f02810f7a6b225f65a.tar.xz forums-bfa7b287344462bbd6f8a0f02810f7a6b225f65a.zip |
[task/git-tools] Append ticket identifier to commit message prior to editing.
PHPBB3-9770
Diffstat (limited to 'git-tools/hooks')
-rwxr-xr-x | git-tools/hooks/commit-msg | 24 | ||||
-rwxr-xr-x | git-tools/hooks/prepare-commit-msg | 10 |
2 files changed, 9 insertions, 25 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg deleted file mode 100755 index db31d93698..0000000000 --- a/git-tools/hooks/commit-msg +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 033cb187c7..2bf25e58a4 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -30,5 +30,13 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")" # * also make sure the branch name begins with bug/ or feature/ if [ "$2" = "" ] then - echo "[$branch] $(cat "$1")" > "$1" + tail=""; + + # Branch is prefixed with 'ticket/', append ticket ID to message + if [ "$branch" != "${branch##ticket/}" ]; + then + tail="\n\nPHPBB3-${branch##ticket/}"; + fi + + echo "[$branch]$tail $(cat "$1")" > "$1" fi |