From 3d2b5b575f1ee3cb8966e56dc895083a3d6e3d7b Mon Sep 17 00:00:00 2001 From: Daniel Bennett <8812489+gulducat@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:26:10 -0400 Subject: [PATCH] Sort git tags when determining prerelease version Tags are sorted lexicographically by default, not by version, so for example right now `git ls-remote` for this repo shows: ``` $ git ls-remote --tags \ https://github.com/github/copilot-cli \ | tail -3 | awk -F/ '{print$NF}' v1.0.8 v1.0.8-0 v1.0.9 ``` With the sort option, it shows the correct latest prerelease tags: ``` $ git ls-remote --tags --sort "version:refname" \ https://github.com/github/copilot-cli \ | tail -3 | awk -F/ '{print$NF}' v1.0.12-0 v1.0.12-1 v1.0.12-2 ``` This option for git ls-remote was added in git version 2.18.0 in June 2018: https://github.com/git/git/blob/v2.18.0/Documentation/RelNotes/2.18.0.txt#L69-L70 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 61caf872..76bc23c2 100755 --- a/install.sh +++ b/install.sh @@ -54,7 +54,7 @@ elif [ "${VERSION}" = "prerelease" ]; then echo "Error: git is required to install prerelease versions" >&2 exit 1 fi - VERSION="$(git ls-remote --tags "$GIT_REMOTE" | tail -1 | awk -F/ '{print $NF}')" + VERSION="$(git ls-remote --tags --sort "version:refname" "$GIT_REMOTE" | tail -1 | awk -F/ '{print $NF}')" if [ -z "$VERSION" ]; then echo "Error: Could not determine prerelease version" >&2 exit 1