mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[task/git-tools] Append ticket identifier to commit message prior to editing.
PHPBB3-9770
This commit is contained in:
parent
14e5da90c3
commit
bfa7b28734
2 changed files with 9 additions and 25 deletions
|
@ -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
|
|
|
@ -30,5 +30,13 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")"
|
||||||
# * also make sure the branch name begins with bug/ or feature/
|
# * also make sure the branch name begins with bug/ or feature/
|
||||||
if [ "$2" = "" ]
|
if [ "$2" = "" ]
|
||||||
then
|
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
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue