Skip to content

Commit 80dd451

Browse files
committed
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 <[email protected]>
1 parent 6788827 commit 80dd451

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

git-sh-setup.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,20 @@ create_virtual_base() {
292292
# Platform specific tweaks to work around some commands
293293
case $(uname -s) in
294294
*MINGW*)
295-
# Windows has its own (incompatible) sort and find
296-
sort () {
297-
/usr/bin/sort "$@"
298-
}
299-
find () {
300-
/usr/bin/find "$@"
301-
}
295+
if test -x /usr/bin/sort
296+
then
297+
# Windows has its own (incompatible) sort; override
298+
sort () {
299+
/usr/bin/sort "$@"
300+
}
301+
fi
302+
if test -x /usr/bin/find
303+
then
304+
# Windows has its own (incompatible) find; override
305+
find () {
306+
/usr/bin/find "$@"
307+
}
308+
fi
302309
# git sees Windows-style pwd
303310
pwd () {
304311
builtin pwd -W

t/test-lib.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,13 +1710,20 @@ fi
17101710
uname_s=$(uname -s)
17111711
case $uname_s in
17121712
*MINGW*)
1713-
# Windows has its own (incompatible) sort and find
1714-
sort () {
1715-
/usr/bin/sort "$@"
1716-
}
1717-
find () {
1718-
/usr/bin/find "$@"
1719-
}
1713+
if test -x /usr/bin/sort
1714+
then
1715+
# Windows has its own (incompatible) sort; override
1716+
sort () {
1717+
/usr/bin/sort "$@"
1718+
}
1719+
fi
1720+
if test -x /usr/bin/find
1721+
then
1722+
# Windows has its own (incompatible) find; override
1723+
find () {
1724+
/usr/bin/find "$@"
1725+
}
1726+
fi
17201727
# git sees Windows-style pwd
17211728
pwd () {
17221729
builtin pwd -W

0 commit comments

Comments
 (0)