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 24, 2024
1 parent fb41649 commit a78bf1f
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -1701,13 +1701,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 a78bf1f

Please sign in to comment.