[PATCH] Avoid using dc in git-count-objects
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 25, 2005, 23:22 UTC
- Message-ID
- <Pine.LNX.4.63.0510260120260.28994@wbgn013.biozentrum.uni-wuerzburg.de>
Using dc is not really necessary, since expr understands summing 32 bit signed integers. Which means that git-count-objects will now fail when 2 GB of unpacked objects have accumulated.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
This is (again) something I found on a default cygwin setup: dc is not installed. I do not even know if you can install dc on cygwin without compiling it yourself.
FYI: I use git-count-objects in t5500-fetch-pack to find out if the correct number of objects was fetched.
git-count-objects.sh | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/git-count-objects.sh b/git-count-objects.sh index 843d2fd..7f9d8e5 100755 --- a/git-count-objects.sh +++ b/git-count-objects.sh @@ -2,12 +2,18 @@ . git-sh-setup +function sum () { + local result=0 + while read line; do + result=$(expr $result + $line) + done + echo $result +} + echo $(find "$GIT_DIR/objects"/?? -type f -print 2>/dev/null | 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 + sed -e 's/[ ].*//' +} | sum) kilobytes