Skip to content

Commit 60bce14

Browse files
dschovdye
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 c567bf2 commit 60bce14

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
@@ -1475,13 +1475,20 @@ fi
14751475
uname_s=$(uname -s)
14761476
case $uname_s in
14771477
*MINGW*)
1478-
# Windows has its own (incompatible) sort and find
1479-
sort () {
1480-
/usr/bin/sort "$@"
1481-
}
1482-
find () {
1483-
/usr/bin/find "$@"
1484-
}
1478+
if test -x /usr/bin/sort
1479+
then
1480+
# Windows has its own (incompatible) sort; override
1481+
sort () {
1482+
/usr/bin/sort "$@"
1483+
}
1484+
fi
1485+
if test -x /usr/bin/find
1486+
then
1487+
# Windows has its own (incompatible) find; override
1488+
find () {
1489+
/usr/bin/find "$@"
1490+
}
1491+
fi
14851492
# git sees Windows-style pwd
14861493
pwd () {
14871494
builtin pwd -W

0 commit comments

Comments
 (0)