]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
throw away output from git ls-remote
authorRudolf Polzer <divverent@alientrap.org>
Mon, 25 Jun 2012 08:53:36 +0000 (10:53 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 25 Jun 2012 08:53:36 +0000 (10:53 +0200)
misc/tools/all/git.subr

index ee53dc57694b7f5711a79c530efb374e39fc0a06..073c5dbacedef5cea4376ebbb67dc8097b1af3a9 100644 (file)
@@ -56,14 +56,15 @@ mirrorspeed()
        # first result is to be ignored, but we use it to check status
        git ls-remote "$1" refs/heads/master >/dev/null 2>&1 || return 1
        # if we can't time, we only check availability
-       if ! { time -p true; } >/dev/null 2>&1; then
+       if ! { time -p sh -c 'true'; } >/dev/null 2>&1; then
                echo 0
                return
        fi
        # now actually time it
        (
                set +x
-               { time -p git ls-remote "$1" refs/heads/master; } 2>&1 >/dev/null | head -n 1 | cut -d ' ' -f 2 | tr -d . | sed 's,^0*,,' | grep . || echo 0
+               export REPO=$1 # so that the sh -c subshell can use it
+               { time -p sh -c 'git ls-remote "$REPO" refs/heads/master >/dev/null 2>&1'; } 2>&1 >/dev/null | head -n 1 | cut -d ' ' -f 2 | tr -d . | sed 's,^0*,,' | grep . || echo 0
                        # unit: clock ticks (depends on what "time" returns
        )
 }