Skip to content

Commit

Permalink
tests: only override sort & find if there are usable ones in /usr/bin/
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 16, 2022
1 parent a879ff8 commit 14597eb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
21 changes: 14 additions & 7 deletions git-sh-setup.sh
Expand Up @@ -292,13 +292,20 @@ create_virtual_base() {
# Platform specific tweaks to work around some commands
case $(uname -s) in
*MINGW*)
# Windows has its own (incompatible) sort and find
sort () {
/usr/bin/sort "$@"
}
find () {
/usr/bin/find "$@"
}
if test -x /usr/bin/sort
then
# Windows has its own (incompatible) sort; override
sort () {
/usr/bin/sort "$@"
}
fi
if test -x /usr/bin/find
then
# Windows has its own (incompatible) find; override
find () {
/usr/bin/find "$@"
}
fi
# git sees Windows-style pwd
pwd () {
builtin pwd -W
Expand Down
21 changes: 14 additions & 7 deletions t/test-lib.sh
Expand Up @@ -1683,13 +1683,20 @@ fi
uname_s=$(uname -s)
case $uname_s in
*MINGW*)
# Windows has its own (incompatible) sort and find
sort () {
/usr/bin/sort "$@"
}
find () {
/usr/bin/find "$@"
}
if test -x /usr/bin/sort
then
# Windows has its own (incompatible) sort; override
sort () {
/usr/bin/sort "$@"
}
fi
if test -x /usr/bin/find
then
# Windows has its own (incompatible) find; override
find () {
/usr/bin/find "$@"
}
fi
# git sees Windows-style pwd
pwd () {
builtin pwd -W
Expand Down

0 comments on commit 14597eb

Please sign in to comment.