]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
cache the checksums of the files
authorRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 13:27:01 +0000 (15:27 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 13:27:01 +0000 (15:27 +0200)
misc/tools/cached-converter.sh

index c500136ff86b6ebeefd62cc35d31aa2882677cee..99800c53a1441c3b620fef8a1d8752f246095677 100755 (executable)
@@ -26,6 +26,8 @@ tmpdir=`mktemp -d -t cached-converter.XXXXXX`
 trap 'exit 1' INT
 trap 'rm -rf "$tmpdir"' EXIT
 
 trap 'exit 1' INT
 trap 'rm -rf "$tmpdir"' EXIT
 
+lastinfiles=
+lastinfileshash=
 cached()
 {
        flag=$1; shift
 cached()
 {
        flag=$1; shift
@@ -41,9 +43,14 @@ cached()
                keep=true
        fi
        options=`echo "$*" | git hash-object --stdin`
                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##*.}"
        fi
        mkdir -p "$CACHEDIR/$method-$options"
        name1="$CACHEDIR/$method-$options/$sum-1.${outfile1##*.}"