From bc2b8d6f54d6ee6b3ceb7f9b7e5bda0bad545eb4 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 17 Sep 2020 14:30:55 +0800 Subject: [PATCH] fix(windows/fix-prepare): fix prepare on windows GitOrigin-RevId: 04e89c28e76fb8690627d1458d347f0a7b797d29 --- 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 8def3c7a7..3cb6da6c6 100755 --- a/third_party/prepare.sh +++ b/third_party/prepare.sh @@ -4,9 +4,16 @@ cd $(dirname $0) source ../ci/utils.sh +# 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