[Libreoffice-commits] core.git: .git-hooks/pre-commit

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 15 10:08:57 UTC 2018


 .git-hooks/pre-commit |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 0623f3a8f5d6fbc5e9b933cb034184084e8ac666
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 15 09:17:02 2018 +0100

    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 at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index e859919fa566..8c4e86345aa1 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -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:


More information about the Libreoffice-commits mailing list