From: Ian Jackson Date: Mon, 9 Jan 2017 12:22:42 +0000 (+0000) Subject: test suite: t-tstunt: When looking for real thing, strip stunt from PATH X-Git-Tag: archive/debian/3.0~35 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=4c85f5a65adbe2a96f0690788a25146950b31397;hp=9fd10d6d6a5b67cbba36a82c1ea5342526c32d50 test suite: t-tstunt: When looking for real thing, strip stunt from PATH Otherwise if we run this again in a fresh environment, the wrapper may be on PATH even though DGIT_TEST_REAL_ is not set. Signed-off-by: Ian Jackson --- diff --git a/tests/lib b/tests/lib index 1def3d36..1af0288a 100644 --- a/tests/lib +++ b/tests/lib @@ -801,7 +801,14 @@ t-tstunt--save-real () { local rc local real set +e - real=$(type -p "$f") + real=$( + p=":$PATH:" + p="${p/:"$tmp/tstunt":/:}" + p="${p%:}" + p="${p#:}" + PATH="$p" + type -p "$f" + ) rc=$? set -e