tests: only override sort & find if there are usable ones in /usr/bin/

The idea is to allow running the test suite on MinGit with BusyBox
installed in /mingw64/bin/sh.exe. In that case, we will want to exclude
sort & find (and other Unix utilities) from being bundled.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-07-18 01:15:40 +02:00
committed by Git for Windows Build Agent
parent 0f2509f8c4
commit d2b7237cc2
2 changed files with 28 additions and 14 deletions

View File

@@ -292,13 +292,20 @@ create_virtual_base() {
# Platform specific tweaks to work around some commands
case $(uname -s) in
*MINGW*)
# Windows has its own (incompatible) sort and find
sort () {
/usr/bin/sort "$@"
}
find () {
/usr/bin/find "$@"
}
if test -x /usr/bin/sort
then
# Windows has its own (incompatible) sort; override
sort () {
/usr/bin/sort "$@"
}
fi
if test -x /usr/bin/find
then
# Windows has its own (incompatible) find; override
find () {
/usr/bin/find "$@"
}
fi
# git sees Windows-style pwd
pwd () {
builtin pwd -W

View File

@@ -1662,13 +1662,20 @@ Darwin)
test_set_prereq EXECKEEPSPID
;;
*MINGW*)
# Windows has its own (incompatible) sort and find
sort () {
/usr/bin/sort "$@"
}
find () {
/usr/bin/find "$@"
}
if test -x /usr/bin/sort
then
# Windows has its own (incompatible) sort; override
sort () {
/usr/bin/sort "$@"
}
fi
if test -x /usr/bin/find
then
# Windows has its own (incompatible) find; override
find () {
/usr/bin/find "$@"
}
fi
# git sees Windows-style pwd
pwd () {
builtin pwd -W