Reputation: 505
I'm under the impression it doesn't, but I can't find any concrete documentation on this. Does Cargo treat semver-compliant tags on Git repos the same way it does for crates on crates.io, namely that cargo update
updates the crate to the newest non-breaking version?
To be more specific, given the following Cargo.toml snippet and assuming the latest version of "crate" is 1.0.1 and a 1.0.1 tag exists for "git_crate", the 1.0.1 version of "crate" will be downloaded. Would cargo install
fetch the 1.0.1 tag for "git_crate" as well, or would it use the 1.0.0 tag?
[dependencies]
crate = "1.0.0"
git_crate = { git = "https://[email protected]/git_crate.git", tag = "1.0.0" }
Upvotes: 1
Views: 709
Reputation: 19662
Git tags are free-form; for example, it is perfectly possible to tag your commit as foobar
and nobody will bat an eyelid. Semver is a common trend people use for their tags; however, is that even a constant? Some people use x.y.z
, others vx.y.z
.
For that reason, cargo will pick the exact tag you specify. You can convince yourself of this by using git daemon
to prop your repo up on a temporary port (9418 by default), and then adding the git repo and its tags. You'll see the following the moment the port is up and daemon is available (but without a valid git repo):
Caused by:
Unable to update http://localhost:9418/?tag=1.0.0
Thus confirming that the only thing cargo does is get the exact tag you mentioned. This is, once again, totally expected.
Upvotes: 2