From 100447ea773288fbe043c6f63a2b5400222d1ab2 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 6 Nov 2016 14:47:46 +0300 Subject: [PATCH] Use `git count-objects` instead of `find` Count loose objects in submodules. --- ls-not-packed | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ls-not-packed b/ls-not-packed index a674f59..d01a953 100755 --- a/ls-not-packed +++ b/ls-not-packed @@ -1,6 +1,12 @@ #! /bin/sh +COUNT_OBJ_PRG="git count-objects -v | grep ^count: | cut -c 8-" +export COUNT_OBJ_PRG + exec "`dirname \"$0\"`"/do-all \ - 'test \ - "`find \"$g\"/objects/ \"$g\"/refs/ \"$g\"/rr-cache/ \ - ! -name HEAD -type f 2>/dev/null | wc -l`" -gt 3 && echo "$d"' + 'cd "$d" && count_obj=`eval $COUNT_OBJ_PRG`; ' \ + 'if [ "$d" != "$g" ]; then' \ + 'for c in `eval git submodule foreach $COUNT_OBJ_PRG`;' \ + 'do count_obj=`expr $count_obj + $c`; done; ' \ + 'fi; ' \ + 'test $count_obj -gt 1 && echo "$d"' \ -- 2.39.2