Skip to content

Commit 05f0559

Browse files
dschoderrickstolee
authored andcommitted
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 7e5ab3b commit 05f0559

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
@@ -333,13 +333,20 @@ create_virtual_base() {
333333
# Platform specific tweaks to work around some commands
334334
case $(uname -s) in
335335
*MINGW*)
336-
# Windows has its own (incompatible) sort and find
337-
sort () {
338-
/usr/bin/sort "$@"
339-
}
340-
find () {
341-
/usr/bin/find "$@"
342-
}
336+
if test -x /usr/bin/sort
337+
then
338+
# Windows has its own (incompatible) sort; override
339+
sort () {
340+
/usr/bin/sort "$@"
341+
}
342+
fi
343+
if test -x /usr/bin/find
344+
then
345+
# Windows has its own (incompatible) find; override
346+
find () {
347+
/usr/bin/find "$@"
348+
}
349+
fi
343350
# git sees Windows-style pwd
344351
pwd () {
345352
builtin pwd -W

t/test-lib.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,13 +1458,20 @@ fi
14581458
uname_s=$(uname -s)
14591459
case $uname_s in
14601460
*MINGW*)
1461-
# Windows has its own (incompatible) sort and find
1462-
sort () {
1463-
/usr/bin/sort "$@"
1464-
}
1465-
find () {
1466-
/usr/bin/find "$@"
1467-
}
1461+
if test -x /usr/bin/sort
1462+
then
1463+
# Windows has its own (incompatible) sort; override
1464+
sort () {
1465+
/usr/bin/sort "$@"
1466+
}
1467+
fi
1468+
if test -x /usr/bin/find
1469+
then
1470+
# Windows has its own (incompatible) find; override
1471+
find () {
1472+
/usr/bin/find "$@"
1473+
}
1474+
fi
14681475
# git sees Windows-style pwd
14691476
pwd () {
14701477
builtin pwd -W

0 commit comments

Comments
 (0)