Created
April 29, 2014 12:49
-
-
Save wchristian/11399320 to your computer and use it in GitHub Desktop.
git-size.pl - size of each commit in a git repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strictures; | |
for my $rev ( `git rev-list --all --pretty=oneline` ) { | |
my $tot = 0; | |
$rev =~ s/\s+$//; | |
( my $sha = $rev ) =~ s/\s.*$//; | |
( my $msg = $rev ) =~ s/^$sha //; | |
for my $blob ( `git diff-tree -r -c -M -C --no-commit-id $sha` ) { | |
$blob = ( split /\s/, $blob )[3]; | |
next if $blob eq "0000000000000000000000000000000000000000"; # Deleted | |
my $size = `echo $blob | git cat-file --batch-check`; | |
$size = ( split /\s/, $size )[2]; | |
$tot += int( $size ); | |
} | |
my $revn = substr( $rev, 0, 40 ); | |
next if $tot < 10000; | |
printf "% 8d %s % 4d %s\n", $tot, $revn, `git show --pretty="format:" --name-only $revn | wc -l`, $msg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment