From 6b2f4b6a850493fa0277ae38ee816d7c5a3a2311 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 22 Jun 2010 16:42:29 +0200 Subject: [task/git-tools] move ticket id appending to commit-msg hook PHPBB3-9770 --- git-tools/hooks/commit-msg | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 git-tools/hooks/commit-msg (limited to 'git-tools/hooks/commit-msg') 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- to ticket/ +# 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 -- cgit v1.2.1