extra-packages allows fetching latest tag of specified package by either not specifying ref or specifying just a tag prefix.
With:
extra-packages: sublimelsp/LSP@4070-
it fails to sort the tags properly and returns some old one. Checked with equivalent code in terminal:
git ls-remote --tags --heads https://github.com/sublimelsp/LSP | sed -E -n "s%.*refs/tags/(4070-[0-9]+\.[0-9]+\.[0-9]+)\$%\1%p" | grep -v '\^{}$' | sort -t. -k1,1nr -k2,2nr -k3,3nr | head -n1
4070-1.30.0
I think it would need to strip the prefix (4070- in this case or v in some other cases) before sorting. Otherwise it's not sorted correctly. But then the original prefix would have to be also included when returning result.
Relevant code:
|
gitResolvePrefixToTag() { |
|
local url="$1" |
|
local prefix="$2" |
|
local refs=$(git ls-remote --tags --heads "$url") |
|
|
|
local exact_match=$(echo "$refs" | sed -E -n "s%.*refs/(heads|tags)/($prefix)\$%\2%p" | head -n1) |
|
if [ -n "$exact_match" ]; then |
|
echo "$exact_match" |
|
return 0 |
|
fi |
|
|
|
if [ -z "$prefix" ]; then |
|
prefix="v?" |
|
fi |
|
|
|
local matched_tags=$(echo "$refs" | sed -E -n "s%.*refs/tags/($prefix[0-9]+\.[0-9]+\.[0-9]+)\$%\1%p" | grep -v '\^{}$') |
|
|
|
echo "$matched_tags" | sort -t. -k1,1nr -k2,2nr -k3,3nr | head -n1 |
|
} |
extra-packagesallows fetching latest tag of specified package by either not specifying ref or specifying just a tag prefix.With:
it fails to sort the tags properly and returns some old one. Checked with equivalent code in terminal:
I think it would need to strip the prefix (
4070-in this case orvin some other cases) before sorting. Otherwise it's not sorted correctly. But then the original prefix would have to be also included when returning result.Relevant code:
UnitTesting/actions/setup/utils.sh
Lines 1 to 19 in 9df1177