Skip to content

Commit fe85588

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 58e721f commit fe85588

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
@@ -1652,13 +1652,20 @@ Darwin)
16521652
test_set_prereq EXECKEEPSPID
16531653
;;
16541654
*MINGW*)
1655-
# Windows has its own (incompatible) sort and find
1656-
sort () {
1657-
/usr/bin/sort "$@"
1658-
}
1659-
find () {
1660-
/usr/bin/find "$@"
1661-
}
1655+
if test -x /usr/bin/sort
1656+
then
1657+
# Windows has its own (incompatible) sort; override
1658+
sort () {
1659+
/usr/bin/sort "$@"
1660+
}
1661+
fi
1662+
if test -x /usr/bin/find
1663+
then
1664+
# Windows has its own (incompatible) find; override
1665+
find () {
1666+
/usr/bin/find "$@"
1667+
}
1668+
fi
16621669
# git sees Windows-style pwd
16631670
pwd () {
16641671
builtin pwd -W

0 commit comments

Comments
 (0)