diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-11-23 12:09:05 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-11-23 12:12:51 +0100 |
commit | 1ff245433ffcf3e906f1241b2eea5322a845e94c (patch) | |
tree | 0ba576a33f2ae36a299c529c246e4d351d988e0a | |
parent | f0092d3bb2ebeff94835ceab6e0bead58d35a349 (diff) | |
download | qtrepotools-1ff245433ffcf3e906f1241b2eea5322a845e94c.tar.gz |
catch bogus author/committer email
(cherry picked from commit d7b51b5dcb5cb253c0fa53723dafc72a633fc09b)
-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 = (); |