diff options
Diffstat (limited to 'git-hooks/sanitize-commit')
-rwxr-xr-x | git-hooks/sanitize-commit | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index cbaf213..6674fa9 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -79,12 +79,19 @@ my $iswip = defined($cfg{wip}); my $revok = defined($cfg{revby}); my $badlog = defined($cfg{log}); my $parents = 0; +my ($badauthor, $badcommitter) = (0, 0); my ($revert1, $revert2, $nonrevert) = (0, 0, 0); open MSG, "git log -1 --pretty=raw ".$sha1." |" or die "cannot run git: $!"; while (<MSG>) { chomp; if (!s/^ //) { - $parents++ if (/^parent /); + if (/^parent /) { + $parents++ ; + } elsif (/^author .*\.\(none\)/) { + $badauthor = 1; + } elsif (/^commiter .*\.\(none\)/) { + $badcommitter = 1; + } next } if ($ln == 0) { @@ -124,6 +131,13 @@ printerr; if ($revert1 && $revert2 && !$nonrevert) { &complain("Revert without justification", "revert", 1); } +# These need to be delayed, because at the time they are found the subject is not known yet. +if ($badauthor) { + &complain("Bogus author email", "email", 1); +} +if ($badcommitter) { + &complain("Bogus committer email", "email", 1); +} my $chunk = 0; my @addi = (); |