From: Rudolf Polzer Date: Thu, 5 Aug 2010 13:27:01 +0000 (+0200) Subject: cache the checksums of the files X-Git-Tag: xonotic-v0.1.0preview~329^2~6 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=27836d0908617449c8f7fc48e045922e17b8c671;hp=6c1a97531688b91940383d3b492b37a2377b78b4 cache the checksums of the files --- diff --git a/misc/tools/cached-converter.sh b/misc/tools/cached-converter.sh index c500136f..99800c53 100755 --- a/misc/tools/cached-converter.sh +++ b/misc/tools/cached-converter.sh @@ -26,6 +26,8 @@ tmpdir=`mktemp -d -t cached-converter.XXXXXX` trap 'exit 1' INT trap 'rm -rf "$tmpdir"' EXIT +lastinfiles= +lastinfileshash= cached() { flag=$1; shift @@ -41,9 +43,14 @@ cached() keep=true fi options=`echo "$*" | git hash-object --stdin` - sum=`git hash-object "$infile1"` - if [ -n "$infile2" ]; then - sum=$sum`git hash-object "$infile2"` + if [ x"$infile1/../$infile2" = x"$lastinfiles" ]; then + sum=$lastinfileshash + else + sum=`git hash-object "$infile1"` + if [ -n "$infile2" ]; then + sum=$sum`git hash-object "$infile2"` + fi + lastinfileshash=$sum fi mkdir -p "$CACHEDIR/$method-$options" name1="$CACHEDIR/$method-$options/$sum-1.${outfile1##*.}"