File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 55#
66# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
77# @author Antony Stubbs
8+ # ChangeLog
9+ #
10+ # Originally by Antony Stubbs http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
11+ #
12+ # <javabrett>
13+ # - Make command work when in the non-root directory of a repo, or from the top-level of a bare repo
14+ #
15+
816
917# set the internal field separator to line break, so that we can iterate easily over the verify-pack output
1018IFS=$' \n ' ;
1119
20+ # find top-level dir of a non-bare repo
21+ _GIT_DIR=` git rev-parse --show-toplevel` || exit 1
22+
23+ if [ -n ${_GIT_DIR} ] && [ -d ${_GIT_DIR} /.git/objects/pack ]; then
24+ PACK_DIR=${_GIT_DIR} /.git/objects/pack
25+ elif [ -d ./objects/pack ]; then
26+ # bare repo
27+ PACK_DIR=./objects/pack
28+ else
29+ echo " Cannot locate pack directory"
30+ exit 1
31+ fi
32+
1233# list all objects including their size, sort by size, take top 10
13- objects=` git verify-pack -v .git/objects/pack /pack-* .idx | grep -v chain | sort -k3nr | head`
34+ objects=` git verify-pack -v ${PACK_DIR} /pack-* .idx | grep -v chain | sort -k3nr | head`
1435
1536echo " All sizes are in kB's. The pack column is the size of the object, compressed, inside the pack file."
1637
You can’t perform that action at this time.
0 commit comments