git pre-commit hook: catch copy&pasted author identity
git log --author="Your" confirms that this happens in practice. Change-Id: I48633bc9154ebc66fc022938831057bdc3ff76b3 Reviewed-on: https://gerrit.libreoffice.org/47892 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
committed by
Michael Meeks
parent
34d8710fff
commit
0623f3a8f5
@@ -109,6 +109,17 @@ sub check_whitespaces($)
|
||||
}
|
||||
}
|
||||
|
||||
sub check_author()
|
||||
{
|
||||
my $author = `git var GIT_AUTHOR_IDENT`;
|
||||
chomp $author;
|
||||
if ($author =~ /^Your Name <you\@example.com>/)
|
||||
{
|
||||
print("ERROR: You have a suspicious author identity: '$author'\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
sub check_style($)
|
||||
{
|
||||
if (! -e "solenv/clang-format/ClangFormat.pm")
|
||||
@@ -266,6 +277,9 @@ check_whitespaces( $against);
|
||||
# fix style in code
|
||||
check_style($against);
|
||||
|
||||
# catch missing author info
|
||||
check_author();
|
||||
|
||||
# all OK
|
||||
exit( 0 );
|
||||
# vi:set shiftwidth=4 expandtab:
|
||||
|
Reference in New Issue
Block a user