Fix 5501 test
Not everybody can rely on /bin/sh to be sane, and we support SHELL_PATH for that. Use it. mktemp(1) is not used anywhere else in the core git. Do not introduce dependency on it. Not everybody's "which" gives a sane return value. For example, on Solaris 'which XXX' says "no XXX in /usr/bin /bin ..." and exits with zero status. The lesson here is to never use 'which' in your scripts. Signed-off-by: Junio C Hamano <junkio@twinsun.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 5, 2005 at 18:13 UTC
8d69195124c826756c025fc84d993d92ff119075
1 file changed
+9
-4
t/t5501-old-fetch-and-upload.sh
+9
-4
@@ -7,8 +7,9 @@
7
# an old counterpart
8
9
cd $(dirname $0) || exit 1
10
+: ${SHELL_PATH=/bin/sh}
11
11
-tmp=$(mktemp /tmp/tmp-XXXXXXXX)
12
+tmp=`pwd`/.tmp$$
13
14
retval=0
15
@@ -25,13 +26,17 @@ for i in $list; do
26
both) pgm="old-git-upload-pack"; replace="old-git-fetch-pack --exec=$pgm";;
27
esac
28
28
- if which $pgm 2>/dev/null; then
29
+ if where=`LANG=C LC_ALL=C which "$pgm" 2>/dev/null` &&
30
+ case "$where" in
31
+ "no "*) (exit 1) ;;
32
+ esac
33
+ then
34
echo "Testing with $pgm"
35
sed -e "s/git-fetch-pack/$replace/g" \
36
-e "s/# old fails/warn/" < t5500-fetch-pack.sh > $tmp
37
33
- sh $tmp || retval=$?
34
- rm $tmp
38
+ "$SHELL_PATH" "$tmp" || retval=$?
39
+ rm -f "$tmp"
40
41
test $retval != 0 && exit $retval
42
else