summaryrefslogtreecommitdiff
path: root/git-count-objects-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-07-31 00:31:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-07-31 18:58:43 (GMT)
commit60036a41e1f25ee3e89142fa92e203dbbc6145cc (patch)
treeee31141f08e3fb26478f25d19cbae01f43013c09 /git-count-objects-script
parent96155e55e175e7fed1d8ebd73557d339f35629d8 (diff)
downloadgit-60036a41e1f25ee3e89142fa92e203dbbc6145cc.zip
git-60036a41e1f25ee3e89142fa92e203dbbc6145cc.tar.gz
git-60036a41e1f25ee3e89142fa92e203dbbc6145cc.tar.bz2
Add a stupid "count objects" script.
This counts the number of unpacked object files and disk space consumed by them, to help you decide when it is a good time to repack. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-count-objects-script')
-rwxr-xr-xgit-count-objects-script13
1 files changed, 13 insertions, 0 deletions
diff --git a/git-count-objects-script b/git-count-objects-script
new file mode 100755
index 0000000..86432db
--- /dev/null
+++ b/git-count-objects-script
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. git-sh-setup-script
+
+echo $(find "$GIT_DIR/objects"/?? -type f -print | wc -l) objects, \
+$({
+ echo 0
+ # "no-such" is to help Darwin folks by not using xargs -r.
+ find "$GIT_DIR/objects"/?? -type f -print 2>/dev/null |
+ xargs du -k "$GIT_DIR/objects/no-such" 2>/dev/null |
+ sed -e 's/[ ].*/ +/'
+ echo p
+} | dc) kilobytes