You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When specifying a dependency using a git repository and a branch, Cargo does not update to track the latest version of that branch when new commits are added, even after a cargo clean. This seems inconsistent with the docs, which state:
Since we haven’t specified any other information, Cargo assumes that we intend to use the latest commit on the master branch to build our package. You can combine the git key with the rev, tag, or branch keys to specify something else. Here's an example of specifying that you want to use the latest commit on a branch named next
After additional commits were added to this branch, Cargo did not use them, and continued to use the version of the dependency from when I first chose this branch. Even switching to a different branch and then back did not work, I was forced to specify the exact revision instead.
Steps
Add a git-based dependency and specify a specific branch
cargo b your project that uses that dependency
Add commits to the git repo of that dependency, on the specified branch
cargo clean && cargo b
Observe that the latest version is not used
Possible Solution(s)
I think it is fine to leave the behavior as is, but the documentation should be corrected to acknowledge this behavior. Alternatively, cargo could be made to actually check for new commits.
Notes
Output of cargo version: cargo 1.40.0 (bc8e4c8 2019-11-22)
(my apologies if this has been fixed since last november)
OS: Ubuntu 20.04
The text was updated successfully, but these errors were encountered:
Yea, the behavior is intentional. One of the fundamental aspects of Cargo is that it has a Cargo.lock file which locks the dependencies to a specific version. With the lock file in place, Cargo will not automatically fetch a new version. You will need to run cargo update to tell it to update the locked version.
Updating that section of the docs seems reasonable to emphasize that once it is locked it will not be updated automatically.
@AlexandreCassagne The above comments and linked issues should have the answer. cargo update helps you with that. See this doc as well. This issue was closed 4 years ago. Please consider opening a new issue instead of leaving a comment here, if it seems to have some bugs.
Problem
When specifying a dependency using a git repository and a branch, Cargo does not update to track the latest version of that branch when new commits are added, even after a
cargo clean
. This seems inconsistent with the docs, which state:I tested this with the following example:
After additional commits were added to this branch, Cargo did not use them, and continued to use the version of the dependency from when I first chose this branch. Even switching to a different branch and then back did not work, I was forced to specify the exact revision instead.
Steps
cargo b
your project that uses that dependencycargo clean && cargo b
Possible Solution(s)
I think it is fine to leave the behavior as is, but the documentation should be corrected to acknowledge this behavior. Alternatively, cargo could be made to actually check for new commits.
Notes
Output of
cargo version
: cargo 1.40.0 (bc8e4c8 2019-11-22)(my apologies if this has been fixed since last november)
OS: Ubuntu 20.04
The text was updated successfully, but these errors were encountered: