From e8ea6dd523aca502268d0e9c9a1a6fa73df23c6a Mon Sep 17 00:00:00 2001 From: zhanghaolong <1041563782@qq.com> Date: Thu, 17 Sep 2020 14:30:55 +0800 Subject: [PATCH] fix(windows/fix-prepare): fix prepare on windows --- third_party/prepare.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/third_party/prepare.sh b/third_party/prepare.sh index f4676aee..c38e282c 100755 --- a/third_party/prepare.sh +++ b/third_party/prepare.sh @@ -2,9 +2,16 @@ cd $(dirname $0) +# force use /usr/bin/sort on windows, /c/Windows/system32/sort do not support -V +OS=$(uname -s) +SORT=sort +if [[ $OS =~ "NT" ]]; then + SORT=/usr/bin/sort +fi + requiredGitVersion="1.8.4" currentGitVersion="$(git --version | awk '{print $3}')" -if [ "$(printf '%s\n' "$requiredGitVersion" "$currentGitVersion" | sort -V | head -n1)" = "$currentGitVersion" ]; then +if [ "$(printf '%s\n' "$requiredGitVersion" "$currentGitVersion" | ${SORT} -V | head -n1)" = "$currentGitVersion" ]; then echo "Please update your Git version. (foud version $currentGitVersion, required version >= $requiredGitVersion)" exit -1 fi -- GitLab