Skip to content

Commit a933af3

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 d42d0dc commit a933af3

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

t/test-lib.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,13 +1607,20 @@ fi
16071607
uname_s=$(uname -s)
16081608
case $uname_s in
16091609
*MINGW*)
1610-
# Windows has its own (incompatible) sort and find
1611-
sort () {
1612-
/usr/bin/sort "$@"
1613-
}
1614-
find () {
1615-
/usr/bin/find "$@"
1616-
}
1610+
if test -x /usr/bin/sort
1611+
then
1612+
# Windows has its own (incompatible) sort; override
1613+
sort () {
1614+
/usr/bin/sort "$@"
1615+
}
1616+
fi
1617+
if test -x /usr/bin/find
1618+
then
1619+
# Windows has its own (incompatible) find; override
1620+
find () {
1621+
/usr/bin/find "$@"
1622+
}
1623+
fi
16171624
# git sees Windows-style pwd
16181625
pwd () {
16191626
builtin pwd -W

0 commit comments

Comments
 (0)