Skip to content

Commit fd54f7d

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 9f9e8b5 commit fd54f7d

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

git-sh-setup.sh

+14-7
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

+14-7
Original file line numberDiff line numberDiff line change
@@ -1697,13 +1697,20 @@ fi
16971697
uname_s=$(uname -s)
16981698
case $uname_s in
16991699
*MINGW*)
1700-
# Windows has its own (incompatible) sort and find
1701-
sort () {
1702-
/usr/bin/sort "$@"
1703-
}
1704-
find () {
1705-
/usr/bin/find "$@"
1706-
}
1700+
if test -x /usr/bin/sort
1701+
then
1702+
# Windows has its own (incompatible) sort; override
1703+
sort () {
1704+
/usr/bin/sort "$@"
1705+
}
1706+
fi
1707+
if test -x /usr/bin/find
1708+
then
1709+
# Windows has its own (incompatible) find; override
1710+
find () {
1711+
/usr/bin/find "$@"
1712+
}
1713+
fi
17071714
# git sees Windows-style pwd
17081715
pwd () {
17091716
builtin pwd -W

0 commit comments

Comments
 (0)