-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Sort git tags when determining prerelease version #2331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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}')" | ||||||
|
||||||
| 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}')" |
There was a problem hiding this comment.
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, withset -e, abort prerelease installs. Consider detecting support (e.g., probegit ls-remote --help/git --version) and falling back to a portable sort (like sorting the tag names locally) when--sortisn't available.There was a problem hiding this comment.
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.