develooper Front page | perl.perl5.porters | Postings from January 2013

Re: git-hook to prevent perlbug as patch author

From:
Thomas Sibley
Date:
January 30, 2013 07:31
Subject:
Re: git-hook to prevent perlbug as patch author
Message ID:
5108CC5F.1080202@bestpractical.com
On 01/29/2013 10:38 PM, Steffen Mueller wrote:
> I will bribe Dennis into installing such post-receive a hook if somebody
> provides it.

The following is adapted from the "update" hook we use at $work (original
written by Alex Vandiver).  Do give it a quick test before deploying.

#!/usr/bin/env perl

# This hook blacklists commits with committer email addresses from
# blacklisted domains.

use strict;
use warnings;

die "No GIT_DIR set" unless $ENV{GIT_DIR};
die "Usage: $0 ref oldrev newrev" unless @ARGV == 3;

my ($refname, $oldrev, $newrev) = @ARGV;

# Deletes are always fine
exit 0 if $newrev eq "0"x40;

my @blacklist = map {chomp; $_} <DATA>;
my $blacklist = join("|", map {"\Q$_\E"} @blacklist);

my @new = map {chomp; $_} `git log --format=\%ae $newrev --not --all`;
for (@new) {
    die "******\n".
        "** Blacklisted committer email: $_\n".
        "** Please ensure you apply attached patches rather than the\n".
        "** entire mail from perlbug or RT.\n".
        "******\n" if /$blacklist/i;
}

exit 0;

__DATA__
perlbug-followup@perl.org
perlbug@perl.org
rt.perl.org




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About