Skip to content

Commit

Permalink
use url again (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipitio authored Apr 15, 2024
1 parent 8a16a6c commit a78cc09
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions advanced/Scripts/speedtestmod/mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ download() {
git remote rename old origin
fi

url=$(git remote get-url origin)
[[ "$url" == *"ipitio"* ]] && snapToTag=$(echo "$snapToTag" | grep -q "true" && echo "false" || echo "true")
git fetch origin --depth=1 $branch:refs/remotes/origin/$branch -q
git reset --hard origin/"$branch" -q
git checkout -B "$branch" -q
Expand All @@ -58,18 +60,15 @@ download() {
local currentCommit=$(getTag "$dest")

if [ -z "$desiredVersion" ]; then # if empty, get the latest version
url=$(git remote get-url origin)
[[ "$url" == *"ipitio"* ]] && snapToTag=$(echo "$snapToTag" | grep -q "true" && echo "false" || echo "true")

if [ "$snapToTag" == "true" ]; then
local latestTag=$(git show-ref --tags | awk -F/ '{print $3}' | grep '^v[0-9]' | grep -v '\^{}' | sort -V | tail -n1)
local latestTag=$(git ls-remote -t "$url" | awk -F/ '{print $3}' | grep '^v[0-9]' | grep -v '\^{}' | sort -V | tail -n1)
[ ! -z "$latestTag" ] && desiredVersion=$latestTag || desiredVersion=$currentCommit
fi
elif $aborting; then
desiredVersion=$(getTag "$desiredVersion")
fi

[[ "$desiredVersion" != *.* ]] || desiredVersion=$(git show-ref --tags | grep $desiredVersion$ | awk '{print $1;}')
[[ "$desiredVersion" != *.* ]] || desiredVersion=$(git ls-remote -t "$url" | grep $desiredVersion$ | awk '{print $1;}')

if [ "$currentCommit" != "$desiredVersion" ]; then
git fetch origin --depth=1 $desiredVersion -q
Expand Down

0 comments on commit a78cc09

Please sign in to comment.