5 # The original genesis for this came from
6 # http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ Antony Stubbs
8 # Modified to use numfmt and only call rev-list once by Don Armstrong
10 # list all objects including their size, sort by size, take top 10
12 ALL_OBJECTS=`git rev-list --all --objects`
13 OBJECTS=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head`
15 OUTPUT="Size,Packed,SHA1,Name";
18 # the size is in the 5th field; convert to IEC
19 SIZE=$(echo "$y" | cut -f 5 -d ' '|numfmt --to=iec)
20 # the compressed size is in the 6th field; convert to IEC
21 COMPRESSED_SIZE=$(echo "$y" | cut -f 6 -d ' '|numfmt --to=iec)
23 SHA=`echo $y | cut -f 1 -d ' '`
24 # find the objects location in the repository tree
25 OTHER=`echo "$ALL_OBJECTS" | grep "$SHA"`
26 OUTPUT="${OUTPUT}\n${SIZE},${COMPRESSED_SIZE},${OTHER}"
29 echo -e $OUTPUT | column -t -s ', '