Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bagder
Created August 9, 2019 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bagder/271c640a8b02bb2ae1b5abf373588e1c to your computer and use it in GitHub Desktop.
Save bagder/271c640a8b02bb2ae1b5abf373588e1c to your computer and use it in GitHub Desktop.
script to extra git authors (per year)
#!/usr/bin/perl
my @a = `git log --use-mailmap --reverse --pretty=fuller --no-color --date=short --decorate=full | egrep "^(Author|CommitDate):"`;
my $c=1;
my $year=1999;
for(@a) {
chomp;
my $line = $_;
if(/^CommitDate: (.*)/) {
if($1 =~ /^(\d\d\d\d)/) {
$year = $1;
}
}
if(/^Author: *([^\<]*) \</) {
my ($auth)=($1);
$uniq{$auth}++;
$uniqyear{$auth.$year}++;
$total{$auth}++;
if($uniq{$auth} == 1) {
# this many did their first commit this year
$when{$year}++;
}
if($uniqyear{$auth.$year} == 1) {
# total count of authors this year
$whenyear{$year}++;
}
#printf "$c;%d\n", scalar(keys %uniq) if(!($c % 50));
$c++;
}
}
# iterate over all authors, count those who did less than three that year
for my $a (sort keys %total) {
for my $y (sort keys %when) {
#print STDERR "check $a for $y\n";
if($uniqyear{$a.$y} && ($uniqyear{$a.$y} < 3)) {
$driveby{$y}++;
}
if($uniqyear{$a.$y} && ($uniqyear{$a.$y} > 9)) {
$tenmore{$y}++;
}
}
}
print "Year;First Commit;Unique Authors;Less than 3 commits;3 commits or more;10 commits or more\n";
for my $y(2000 .. 2019) {
printf("%d;%d;%d;%d;%u;%u\n", $y, $when{$y}, $whenyear{$y}, $driveby{$y},
$whenyear{$y} - $driveby{$y},
$tenmore{$y});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment