Browse Source

fix(windows/fix-prepare): fix prepare on windows

GitOrigin-RevId: 04e89c28e7
tags/v1.6.0-rc1
Megvii Engine Team 4 years ago
parent
commit
bc2b8d6f54
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      third_party/prepare.sh

+ 8
- 1
third_party/prepare.sh View File

@@ -4,9 +4,16 @@ cd $(dirname $0)


source ../ci/utils.sh 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" requiredGitVersion="1.8.4"
currentGitVersion="$(git --version | awk '{print $3}')" 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)" echo "Please update your Git version. (foud version $currentGitVersion, required version >= $requiredGitVersion)"
exit -1 exit -1
fi fi


Loading…
Cancel
Save