From: Rudolf Polzer Date: Mon, 25 Jun 2012 08:53:36 +0000 (+0200) Subject: throw away output from git ls-remote X-Git-Tag: xonotic-v0.7.0~53^2~2 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=dbc359245756c9679db4df85dca960f57071ee6f throw away output from git ls-remote --- diff --git a/misc/tools/all/git.subr b/misc/tools/all/git.subr index ee53dc57..073c5dba 100644 --- a/misc/tools/all/git.subr +++ b/misc/tools/all/git.subr @@ -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 ) }