Skip to content

Commit 4ad40d5

Browse files
dschoGit for Windows Build Agent
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 eb63ee7 commit 4ad40d5

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
@@ -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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,13 +1649,20 @@ Darwin)
16491649
test_set_prereq MACOS
16501650
;;
16511651
*MINGW*)
1652-
# Windows has its own (incompatible) sort and find
1653-
sort () {
1654-
/usr/bin/sort "$@"
1655-
}
1656-
find () {
1657-
/usr/bin/find "$@"
1658-
}
1652+
if test -x /usr/bin/sort
1653+
then
1654+
# Windows has its own (incompatible) sort; override
1655+
sort () {
1656+
/usr/bin/sort "$@"
1657+
}
1658+
fi
1659+
if test -x /usr/bin/find
1660+
then
1661+
# Windows has its own (incompatible) find; override
1662+
find () {
1663+
/usr/bin/find "$@"
1664+
}
1665+
fi
16591666
# git sees Windows-style pwd
16601667
pwd () {
16611668
builtin pwd -W

0 commit comments

Comments
 (0)