dotfiles.2022/_home/private_dot_local/bin/executable_identify-large-g...

14 lines
485 B
Bash

#! /usr/bin/env bash
LIMIT=${1:-10}
REV_LIST="$(git rev-list --objects --all)"
find $(git rev-parse --git-dir)/objects/pack -type f -name "pack-*.idx" \
| while read pack; do
git verify-pack -v "$pack" | sort -nrk 3 | head -${LIMIT}
done | sort -nrk 3 | head -${LIMIT} \
| while read blobinfo; do
blob=$(echo "$blobinfo" | cut -f1 -d' ')
printf "%s %12s %s\n" $(echo "$blobinfo" | cut -f1,5 -d' ') "$(echo "$REV_LIST" | grep "$blob" | cut -f2 -d' ';)"
done
unset REV_LIST