Skip to content

Commit 8eadce0

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 4752d15 commit 8eadce0

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
@@ -309,13 +309,20 @@ create_virtual_base() {
309309
# Platform specific tweaks to work around some commands
310310
case $(uname -s) in
311311
*MINGW*)
312-
# Windows has its own (incompatible) sort and find
313-
sort () {
314-
/usr/bin/sort "$@"
315-
}
316-
find () {
317-
/usr/bin/find "$@"
318-
}
312+
if test -x /usr/bin/sort
313+
then
314+
# Windows has its own (incompatible) sort; override
315+
sort () {
316+
/usr/bin/sort "$@"
317+
}
318+
fi
319+
if test -x /usr/bin/find
320+
then
321+
# Windows has its own (incompatible) find; override
322+
find () {
323+
/usr/bin/find "$@"
324+
}
325+
fi
319326
# git sees Windows-style pwd
320327
pwd () {
321328
builtin pwd -W

t/test-lib.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,13 +1553,20 @@ fi
15531553
uname_s=$(uname -s)
15541554
case $uname_s in
15551555
*MINGW*)
1556-
# Windows has its own (incompatible) sort and find
1557-
sort () {
1558-
/usr/bin/sort "$@"
1559-
}
1560-
find () {
1561-
/usr/bin/find "$@"
1562-
}
1556+
if test -x /usr/bin/sort
1557+
then
1558+
# Windows has its own (incompatible) sort; override
1559+
sort () {
1560+
/usr/bin/sort "$@"
1561+
}
1562+
fi
1563+
if test -x /usr/bin/find
1564+
then
1565+
# Windows has its own (incompatible) find; override
1566+
find () {
1567+
/usr/bin/find "$@"
1568+
}
1569+
fi
15631570
# git sees Windows-style pwd
15641571
pwd () {
15651572
builtin pwd -W

0 commit comments

Comments
 (0)