aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2010-07-12 02:04:29 +0100
committerChris Smith <toonarmy@phpbb.com>2010-08-10 14:48:46 +0100
commite17ffa01e6f536b0868106405993361f1d978706 (patch)
tree4d804fcadda35e389de844129477fe8750f9a1df
parent[task/git-tools] Adjust the hook to enforce that a ticket is always mentioned (diff)
downloadphpbb-e17ffa01e6f536b0868106405993361f1d978706.tar.gz
phpbb-e17ffa01e6f536b0868106405993361f1d978706.tar.bz2
phpbb-e17ffa01e6f536b0868106405993361f1d978706.zip
[task/git-tools] Ignore git commit message comments
Git commit message comments can be contained anywhere in the message and this change ignores where they appear. PHPBB3-9768
-rwxr-xr-xgit-tools/hooks/commit-msg14
1 files changed, 13 insertions, 1 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
index b04a761c29..d6ad57a38a 100755
--- a/git-tools/hooks/commit-msg
+++ b/git-tools/hooks/commit-msg
@@ -87,6 +87,12 @@ do
quit $err;
fi
+ if [ "${expecting#comment}" = "$expecting" ]
+ then
+ # Prefix comments to the expected tokens list
+ expecting="comment $expecting";
+ fi
+
debug 2 "Expecting: $expecting";
# Loop over each of the expected line formats
@@ -121,6 +127,9 @@ do
# Should not end up here
false
;;
+ "comment")
+ echo "$line" | grep -Eq "^#";
+ ;;
*)
echo "Unrecognised token $expect" >&2;
quit $err;
@@ -143,7 +152,7 @@ do
if [ $result -eq 0 ]
then
# Have we switched out of description mode?
- if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ]
+ if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ]
then
# Yes, okay we need to backtrace one line and reanalyse
in_description=0;
@@ -186,6 +195,9 @@ do
tickets="$tickets $line";
fi
;;
+ "comment")
+ # Comments should expect the same thing again
+ ;;
*)
echo "Unrecognised token $expect" >&2;
quit 254;