skip expensive hash-object calls where not needed
authorRudolf Polzer <divverent@alientrap.org>
Mon, 6 Sep 2010 07:11:34 +0000 (09:11 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 6 Sep 2010 07:11:34 +0000 (09:11 +0200)
all
misc/tools/cached-converter.sh

diff --git a/all b/all
index b48fe356f12e0aacbaab5186ae9251323ad5e3b2..29e8a65c0aff1273347f5ec05fa864ae1e11b5ad 100755 (executable)
--- a/all
+++ b/all
@@ -1177,6 +1177,7 @@ case "$cmd" in
                                fi
                        done
                fi
+               verbose export git_src_repo="$d0/$src" # skip hash-object
                verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
                verbose zip -9yr "../../$dst" .
                verbose cd ../..
index 361265881865430d5b4ccaa09924d7bca6709003..0eab3d6946f5ae9fc10048afd7704ffb38a35c97 100755 (executable)
@@ -12,6 +12,7 @@ set -e
 : ${do_ogg:=false}
 : ${ogg_qual:=1}
 : ${del_src:=false}
+: ${git_src_repo:=}
 
 me=$0
 case "$me" in
@@ -47,9 +48,16 @@ cached()
        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"`
+               if [ -n "$git_src_repo" ]; then
+                       sum=`( cd "$git_src_repo"; git rev-parse HEAD:"$infile1" )`
+                       if [ -n "$infile2" ]; then
+                               sum=`( cd "$git_src_repo"; git rev-parse HEAD:"$infile2" )`
+                       fi
+               else
+                       sum=`git hash-object "$infile1"`
+                       if [ -n "$infile2" ]; then
+                               sum=$sum`git hash-object "$infile2"`
+                       fi
                fi
                lastinfileshash=$sum
        fi