Skip to content

Instantly share code, notes, and snippets.

@olof
Created September 20, 2017 17:37
Show Gist options
  • Save olof/7c5d49f7f92601a7f49d1db2554cd159 to your computer and use it in GitHub Desktop.
Save olof/7c5d49f7f92601a7f49d1db2554cd159 to your computer and use it in GitHub Desktop.
# Who has contributed the most to your repository? Both in terms of
# net additions, and total changes. (Just change $_->{loc_net} to
# $_->{loc_tot} at the end of the command.
(printf -- '---\nchanges:\n'; git log --stat --format=' - name: %aE' | grep -v -e \| -e ^$ | sed -re 's/[^,]+, / loc: /' -e 's/([0-9]+) insertions?\(\+\)/\1/' -e 's/(, )?([0-9]+) deletions?\(-\)/-\2/' ) | perl -MYAML -MData::Dumper -E '$db = Load(do { local $/; <> })->{changes}; @p = map { { loc_net => eval "$_->{loc}", loc_tot => eval($_->{loc} =~ s/-/+/r) , name => $_->{name} } } @$db; print Dump \@p' | perl -MYAML -E '$db = Load(do { local $/; <> }); my $h = {}; $h->{$_->{name}} += $_->{loc_net} for @$db; print Dump $h' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment