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
# gist to create file size list: | |
# run this in irb in your git folder. | |
# will output a text file to the parent folder with a listing of each filepath and file size. | |
# NOTE: nil is added to the end of each line to prevent outputting the result of the iterator blocks. | |
lines = `git gc && git verify-pack -v .git/objects/pack/pack-*.idx`.split("\n"); nil | |
objects = lines.find_all{ |line| line.match(/^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$/) }; nil | |
shas = `git rev-list --objects --all | sort -k 2`.chomp.split("\n"); nil | |
map = shas.inject({}){ |hash, line| sha, file = line.split(' '); hash[sha] = file unless file.nil?; hash }; nil | |
sizes = objects.map{ |line| sha, type, size = line.gsub(/\s+/, ' ').split(' '); file = map[sha]; [size.to_i, file] if file }; nil |