diff options
author | Casimir Saastamoinen <casimir.saastamoinen@qt.io> | 2023-07-21 13:39:55 +0300 |
---|---|---|
committer | Casimir Saastamoinen <casimir.saastamoinen@qt.io> | 2023-08-09 10:07:13 +0000 |
commit | e6f2e023492d3ded8ebeca331670bfc907dbd2fb (patch) | |
tree | abb53c419941a8cfe2b85bb0366f0769b4f0891b /git-hooks | |
parent | 9c5662202d21ed5b472e0bac80fd0a734ee0480e (diff) |
Complain when there are two newlines back to back
Task-number: QTQAINFRA-5498
Change-Id: I94360ee7407f247c35ce54d48cb0f08101d05511
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/sanitize-commit | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index 8735e15..accf82f 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -419,6 +419,7 @@ my ($revert1, $revert2, $nonrevert) = (0, 0, 0); my ($coverity, $cid) = (0, 0); my $msgline = 0; my %picktos = (); +my $prevline = ""; open MSG, "git cat-file -p ".$sha1." |" or die "cannot run git: $!"; while (<MSG>) { last if ($_ eq "\n"); @@ -474,6 +475,9 @@ while (<MSG>) { $inchangelog = 0; # Empty line following footer(s). $footer = ($footer == STS_FOOTER) ? STS_FTR_BLNK : STS_BLANK; + if ($prevline eq "") { + complain_cln("Two trailing newlines", "log"); + } } elsif ($cherry) { $cherry = 0 if (/\)/); } else { @@ -562,6 +566,7 @@ while (<MSG>) { $footer = STS_TEXT; } } + $prevline = $_; } if (!$badid && /\bI[0-9a-f]{40}\b/ && !/^Change-Id: /) { |