-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Cargo should reference git dependencies by commit hash instead of url #7497
Copy link
Copy link
Open
Labels
A-crate-dependenciesArea: [dependencies] of any kindArea: [dependencies] of any kindA-gitArea: anything dealing with gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Metadata
Metadata
Assignees
Labels
A-crate-dependenciesArea: [dependencies] of any kindArea: [dependencies] of any kindA-gitArea: anything dealing with gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Type
Fields
Give feedbackNo fields configured for issues without a type.
cargo thinks the following dependencies are different although they are exactly the same:
assuming that branch
cccHEAD as well as tagdddpoints torev = "0123456789abcdef", being the HEAD ofmaster. Moreover,fff/bbbbeing a fresh fork of repositorybbbby userfffI would suggest that all these references are being treated as equal because they are.
The fact that cargo doesn't know that all these dependencies are equal causes a lot of trouble:
The great thing about git is that a commit hash is a unique fingerprint of a repository. It doesn't matter on which branch, tag or even in which organization the reference is located. The commit hash is the same, so is the code.
actually, just writing
might not be practical, but it would be unique across the entirety of all git repositories in existence. The only problem being to retrieve the corresponding code if you don't know the url, so I'm not suggesting this syntax. I just want to make the point that - behind the scenes - cargo could very well use a git commit hash without any url, branch or tag as an identifier for a specific version of a crate.