1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

build: ignore scissor line for the commit-msg hook

* build-aux/git-hooks/commit-msg: Stop processing more lines when the
  scissor line is encountered.
--
This allows the command `git commit -v` to work even if the code is
longer than 72 characters. Note that comments are already ignored by the
previous line.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2015-07-09 17:11:33 +02:00 committed by Werner Koch
parent dbf4534f49
commit d24165bce2
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -86,11 +86,17 @@ sub check_msg($$)
2 <= @line && length $line[1] 2 <= @line && length $line[1]
and return 'second line must be empty'; and return 'second line must be empty';
# See git-commit(1), this is the --cleanup=scissors option. Everything
# after and including this line gets ignored.
my $marker = '# ------------------------ >8 ------------------------';
# Limit line length to allow for the ChangeLog's leading TAB. # Limit line length to allow for the ChangeLog's leading TAB.
foreach my $line (@line) foreach my $line (@line)
{ {
72 < length $line && $line =~ /^[^#]/ 72 < length $line && $line =~ /^[^#]/
and return 'line longer than 72 characters'; and return 'line longer than 72 characters';
last if $line eq $marker;
} }
return ''; return '';