diff options
Diffstat (limited to 'git-tools/hooks')
-rwxr-xr-x | git-tools/hooks/commit-msg | 14 |
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; |