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 specifying a non-branch/non-tag ref for git dependencies #7230

Closed
Nemo157 opened this issue Aug 9, 2019 · 2 comments
Closed

Allow specifying a non-branch/non-tag ref for git dependencies #7230

Nemo157 opened this issue Aug 9, 2019 · 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`

Comments

@Nemo157
Copy link
Member

Nemo157 commented Aug 9, 2019

Describe the problem you are trying to solve
Adding a patch section referring to a reference that is not a branch or tag of the repository. For example refs/pull/<id>/head to refer to a pull request on Github.

Describe the solution you'd like
An additional ref key to go with branch, tag and rev that allows passing in a fully-qualified reference to lookup.

Notes
This may be slightly complicated as it appears that Cargo does a fetch of just refs/heads/*:refs/heads/* before looking up the specified branch locally. It might be better in any case to only fetch the requested ref from the remote to reduce traffic on repositories that have a large number of branches.

@Nemo157 Nemo157 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 9, 2019
@Nemo157
Copy link
Member Author

Nemo157 commented Aug 9, 2019

What I mention in the note would also allow accessing revisions that are not ancestors of any public branch/tag as long as they are accessible in the remote repository. Basically performing a git fetch <repository> <rev> or git fetch <repository> <ref>:<ref> to only pull the single commit and ancestors before looking it up locally.

@ehuss ehuss added the A-git Area: anything dealing with git label Sep 21, 2019
@ehuss
Copy link
Contributor

ehuss commented Jan 4, 2022

This should now be implemented (via #9859 now in 1.57) to fetch any ref with the syntax rev="refs/...":

[dependencies]
cargo = { git = "https://github.com/rust-lang/cargo.git", rev = "refs/pull/9859/head" }

I'm going to close as resolved, though feel free to reopen if I have misinterpreted the request.

@ehuss ehuss closed this as completed Jan 4, 2022
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`
Projects
None yet
Development

No branches or pull requests

2 participants