]> git.donarmstrong.com Git - bin.git/commitdiff
we really care only about the packed size
authorDon Armstrong <don@donarmstrong.com>
Wed, 10 May 2017 21:29:38 +0000 (14:29 -0700)
committerDon Armstrong <don@donarmstrong.com>
Wed, 17 May 2017 21:44:44 +0000 (16:44 -0500)
git-hogs

index c74f628cda6588d47090768dc2d4cf53c8acd5fa..db5942af46ceb4115f892aee82add831178f26b3 100755 (executable)
--- a/git-hogs
+++ b/git-hogs
 NUM="${1:-10}"
 
 ALL_OBJECTS=`git rev-list --all --objects`
-OBJECTS=`git cat-file --batch-check='%(objectsize) %(objectsize:disk) %(objectname) %(objecttype)' --batch-all-objects|grep blob| sort -nr | head -n $NUM`
+OBJECTS=`git cat-file --batch-check='%(objectsize:disk) %(objectsize) %(objectname) %(objecttype)' --batch-all-objects|grep blob| sort -nr | head -n $NUM`
 IFS=$'\n'
 OUTPUT="Size,Packed,SHA1,Name";
 for y in $OBJECTS
 do
        # the size is in the 5th field; convert to IEC
-       SIZE=$(echo "$y" | cut -f 1 -d ' '|numfmt --to=iec)
+       SIZE=$(echo "$y" | cut -f 2 -d ' '|numfmt --to=iec)
        # the compressed size is in the 6th field; convert to IEC
-       COMPRESSED_SIZE=$(echo "$y" | cut -f 2 -d ' '|numfmt --to=iec)
+       COMPRESSED_SIZE=$(echo "$y" | cut -f 1 -d ' '|numfmt --to=iec)
        # extract the SHA
        SHA=`echo $y | cut -f 3 -d ' '`
        # find the objects location in the repository tree