From dbc359245756c9679db4df85dca960f57071ee6f Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 25 Jun 2012 10:53:36 +0200 Subject: [PATCH] throw away output from git ls-remote --- misc/tools/all/git.subr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 ) } -- 2.39.2