Skip to content

Commit 4dadd00

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 09f492d commit 4dadd00

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
@@ -1647,13 +1647,20 @@ Darwin)
16471647
test_set_prereq MACOS
16481648
;;
16491649
*MINGW*)
1650-
# Windows has its own (incompatible) sort and find
1651-
sort () {
1652-
/usr/bin/sort "$@"
1653-
}
1654-
find () {
1655-
/usr/bin/find "$@"
1656-
}
1650+
if test -x /usr/bin/sort
1651+
then
1652+
# Windows has its own (incompatible) sort; override
1653+
sort () {
1654+
/usr/bin/sort "$@"
1655+
}
1656+
fi
1657+
if test -x /usr/bin/find
1658+
then
1659+
# Windows has its own (incompatible) find; override
1660+
find () {
1661+
/usr/bin/find "$@"
1662+
}
1663+
fi
16571664
# git sees Windows-style pwd
16581665
pwd () {
16591666
builtin pwd -W

0 commit comments

Comments
 (0)