mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 15:35:11 +02:00
Merge pull request #6390 from marc1706/ticket/16988
[ticket/16988] Improve handling of appended branch info and security branches
This commit is contained in:
commit
c61c130596
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# A hook to add [$branch] to the beginning of a commit message
|
# A hook to add [$branch] to the beginning of a commit message
|
||||||
# if certain conditions are met.
|
# if certain conditions are met.
|
||||||
@ -31,12 +31,19 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")"
|
|||||||
if [ "$2" = "" ]
|
if [ "$2" = "" ]
|
||||||
then
|
then
|
||||||
tail="";
|
tail="";
|
||||||
|
ticket_id=$(sed -E 's/(ticket\/)(security\/)?([0-9]+)(.+$)?/\3/gm;t;d' <<< "$branch");
|
||||||
|
branch_title=$(sed -E 's/(ticket\/)(security\/)?([0-9]+)(.+$)?/\1\2\3/gm;t;d' <<< "$branch");
|
||||||
|
|
||||||
|
if [ "security/" = "$(sed -E 's/(ticket\/)(security\/)?([0-9]+)(.+$)?/\2/gm;t;d' <<< "$branch")" ];
|
||||||
|
then
|
||||||
|
tail="$(printf '\n\nSECURITY-%s' "$ticket_id")";
|
||||||
|
else
|
||||||
# Branch is prefixed with 'ticket/', append ticket ID to message
|
# Branch is prefixed with 'ticket/', append ticket ID to message
|
||||||
if [ "$branch" != "${branch##ticket/}" ];
|
if [ "$branch" != "${branch##ticket/}" ];
|
||||||
then
|
then
|
||||||
tail="$(printf "\n\nPHPBB3-${branch##ticket/}")";
|
tail="$(printf '\n\nPHPBB3-%s' "$ticket_id")";
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$branch] $tail$(cat "$1")" > "$1"
|
echo "[$branch_title] $tail$(cat "$1")" > "$1"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user