Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}')"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git ls-remote --tags --sort "version:refname" ... requires git >= 2.18.0; on older systems this will exit non-zero and, with set -e, abort prerelease installs. Consider detecting support (e.g., probe git ls-remote --help/git --version) and falling back to a portable sort (like sorting the tag names locally) when --sort isn't available.

Suggested change
VERSION="$(git ls-remote --tags --sort "version:refname" "$GIT_REMOTE" | tail -1 | awk -F/ '{print $NF}')"
# Prefer using git's built-in tag sorting when available (git >= 2.18.0),
# but fall back to a portable local sort for older git versions.
if git ls-remote --help 2>&1 | grep -q -- '--sort'; then
VERSION="$(git ls-remote --tags --sort="version:refname" "$GIT_REMOTE" | tail -1 | awk -F/ '{print $NF}')"
else
VERSION="$(git ls-remote --tags "$GIT_REMOTE" \
| awk '{print $2}' \
| awk -F/ '{print $NF}' \
| sort -V \
| tail -1)"
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git 2.18 came out in 2018, which you might believe to be ancient history, but I half-expect to hear from some CentOS user about this. Then again, they're also probably not going to be able to run the binary at all, so I'll let it slide.

Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch is documented as “Get the latest prerelease tag”, but the command picks the highest overall version tag. If a stable tag (e.g. v1.0.12) exists, this will resolve to the stable release rather than a prerelease (e.g. v1.0.12-2). Consider filtering to prerelease tags (e.g. tags containing -) before selecting the latest.

Suggested change
VERSION="$(git ls-remote --tags --sort "version:refname" "$GIT_REMOTE" | tail -1 | awk -F/ '{print $NF}')"
VERSION="$(git ls-remote --tags --sort "version:refname" "$GIT_REMOTE" 'refs/tags/*-*' | tail -1 | awk -F/ '{print $NF}')"

Copilot uses AI. Check for mistakes.
if [ -z "$VERSION" ]; then
echo "Error: Could not determine prerelease version" >&2
exit 1
Expand Down
Loading