Skip to content

Commit 17ebcee

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 af0cf8c commit 17ebcee

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
@@ -1654,13 +1654,20 @@ Darwin)
16541654
test_set_prereq EXECKEEPSPID
16551655
;;
16561656
*MINGW*)
1657-
# Windows has its own (incompatible) sort and find
1658-
sort () {
1659-
/usr/bin/sort "$@"
1660-
}
1661-
find () {
1662-
/usr/bin/find "$@"
1663-
}
1657+
if test -x /usr/bin/sort
1658+
then
1659+
# Windows has its own (incompatible) sort; override
1660+
sort () {
1661+
/usr/bin/sort "$@"
1662+
}
1663+
fi
1664+
if test -x /usr/bin/find
1665+
then
1666+
# Windows has its own (incompatible) find; override
1667+
find () {
1668+
/usr/bin/find "$@"
1669+
}
1670+
fi
16641671
# git sees Windows-style pwd
16651672
pwd () {
16661673
builtin pwd -W

0 commit comments

Comments
 (0)