aboutsummaryrefslogtreecommitdiff
blob: db31d936984855327b7c4a9cdb07a87cadbb0583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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