Skip to content
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

Allow using cargo install --git <url> to install latest tag #13940

Closed
Coekjan opened this issue May 21, 2024 · 2 comments
Closed

Allow using cargo install --git <url> to install latest tag #13940

Coekjan opened this issue May 21, 2024 · 2 comments
Labels
A-git Area: anything dealing with git C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-triage Status: This issue is waiting on initial triage.

Comments

@Coekjan
Copy link

Coekjan commented May 21, 2024

Problem

Users may want to install latest tagged version of binary from git repo. But they now must:

  1. Browse to the repo and find the latest tag <tag>.
  2. Run cargo install --git <url> --tag <tag>.

Proposed Solution

Maybe we can allow users to directly install the latest tag, like: cargo install --git <url> --tag latest. To implement this behavior, we need to query the git repo (like the following bash script), and take the latest one to install.

git -c 'versionsort.suffix=-' ls-remote --refs --tags --sort=version:refname $URL

Notes

No response

@Coekjan Coekjan added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels May 21, 2024
@epage epage added A-git Area: anything dealing with git Command-install labels May 21, 2024
@epage
Copy link
Contributor

epage commented May 21, 2024

We likely wouldn't want to assume a tag named latest doesn't exist. While generally people treat tags as immutable, there are exception cases.

As for version-sorting the tags, this doesn't work in monorepos. I tried this on a repo for one of my bin packages and the tags returned have nothing to do with my bin and could be much older than the latest tag for my bin.

@Coekjan
Copy link
Author

Coekjan commented May 22, 2024

I just realized that, at the most time, we can install the latest one from registry instead of git repo. So the proposal makes less sense.

If so, we can close the issue.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants