Created
February 13, 2017 07:30
-
-
Save amaslenn/de76b7bca22716c7ad7a46bf6ebf23bd to your computer and use it in GitHub Desktop.
Get size of commits using perl
This file contains 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
# found here: http://stackoverflow.com/questions/1286183/git-find-fat-commit | |
#!/usr/bin/perl | |
foreach my $rev (`git rev-list --all --pretty=oneline`) { | |
my $tot = 0; | |
($sha = $rev) =~ s/\s.*$//; | |
foreach my $blob (`git diff-tree -r -c -M -C --no-commit-id $sha`) { | |
$blob = (split /\s/, $blob)[3]; | |
next if $blob == "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); | |
# if ($tot > 1000000) { | |
print "$tot $revn " . `git show --pretty="format:" --name-only $revn | wc -l` ; | |
# } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment