mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[task/git-tools] move ticket id appending to commit-msg hook
PHPBB3-9770
This commit is contained in:
parent
f0509e4620
commit
6b2f4b6a85
2 changed files with 24 additions and 7 deletions
24
git-tools/hooks/commit-msg
Executable file
24
git-tools/hooks/commit-msg
Executable file
|
@ -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
|
|
@ -32,10 +32,3 @@ if [ "$2" = "" ]
|
||||||
then
|
then
|
||||||
echo "[$branch] $(cat "$1")" > "$1"
|
echo "[$branch] $(cat "$1")" > "$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (echo $branch | grep '^ticket/')
|
|
||||||
then
|
|
||||||
ticket_id="$(echo $branch | sed "s/ticket\///g")"
|
|
||||||
echo >> "$1"
|
|
||||||
echo "PHPBB3-$ticket_id" >> "$1"
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue