From cd4ce16f0fa35828ce33cc2fa90b4ab6528a28ea Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 9 Sep 2007 21:00:47 +0200 Subject: [PATCH] Work around incompatible sort and find on windows. If the PATH lists the Windows system directories before the MSYS directories, Windows's own incompatible sort and find commands would be picked up. We implement these commands as functions and call the real tools by absolute path. Also add a dummy implementation of sync to avoid an error in git-repack. Signed-off-by: Johannes Sixt --- git-clone.sh | 10 ++++++++++ git-ls-remote.sh | 13 +++++++++++++ git-sh-setup.sh | 17 +++++++++++++++++ t/test-lib.sh | 13 +++++++++++++ 4 files changed, 53 insertions(+) diff --git a/git-clone.sh b/git-clone.sh index 7796201ada..e262f77136 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -13,6 +13,16 @@ die() { exit 1 } +# Fix some commands on Windows +case $(uname -s) in +*MINGW*) + # Windows has its own (incompatible) find + find () { + /usr/bin/find "$@" + } + ;; +esac + usage() { die "Usage: $0 [--template=] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [--origin ] [--depth ] [-n] []" } diff --git a/git-ls-remote.sh b/git-ls-remote.sh index 4d37934f62..0d7508407b 100755 --- a/git-ls-remote.sh +++ b/git-ls-remote.sh @@ -12,6 +12,19 @@ die () { exit 1 } +# Fix some commands on Windows +case $(uname -s) in +*MINGW*) + # Windows has its own (incompatible) sort and find + sort () { + /usr/bin/sort "$@" + } + find () { + /usr/bin/find "$@" + } + ;; +esac + exec= while case "$#" in 0) break;; esac do diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 185c5c6c95..74b2389d9a 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -129,3 +129,20 @@ test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || { } : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} + +# Fix some commands on Windows +case $(uname -s) in +*MINGW*) + # Windows has its own (incompatible) sort and find + sort () { + /usr/bin/sort "$@" + } + find () { + /usr/bin/find "$@" + } + # sync is missing + sync () { + : # no implementation + } + ;; +esac diff --git a/t/test-lib.sh b/t/test-lib.sh index a3f3d7c922..fed377fc1c 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -305,3 +305,16 @@ do test_done esac done + +# Fix some commands on Windows +case $(uname -s) in +*MINGW*) + # Windows has its own (incompatible) sort and find + sort () { + /usr/bin/sort "$@" + } + find () { + /usr/bin/find "$@" + } + ;; +esac