Description
Problem
When using a local registry located at /home/user/rust/crates.io-index
(which is simply a clone of https://github.com/rust-lang/crates.io-index.git
) , specified in ~/.cargo/config
using the following config:
[source]
[source.mirror]
registry = "file:///home/user/rust/crates.io-index"
[source.crates-io]
replace-with = "mirror"
is used, cargo update
progresses incredibly slowly, consumes 1 CPU and slowly increases its RAM usage, given that the project has at least one dependency. That's to say: when running cargo update
the process takes very long.
The total update time was 21 minutes.
However, when ~/.cargo/config
is changed to
[net]
git-fetch-with-cli = true
[source]
[source.mirror]
registry = "file:///home/jona/projects/rust/crates.io-index"
[source.crates-io]
replace-with = "mirror"
the update actually succeeds relatively quickly, which is the expected behaviour. With this option, the update took about 21 seconds.
Steps
- Install rust
- Clone
https://github.com/rust-lang/crates.io-index.git
- Edit/add the local source and overriding of the crates-io source to
~/.cargo/config
using the first of the above examples. Point the mirror source to the directory into whichcrates.io-index
was cloned. - Create an empty/basic project
- Add a dependency to this project (I used
time = "0.1.0"
, but as far as I can tell any dependency that triggers an update of the registry will cause this issue) - Attempt to run
cargo update
Possible Solution(s)
Use
[net]
git-fetch-with-cli = true
in cargo configuration.
Notes
Output of cargo version
:
I tested found the issue on 1.46.0, 1.49.0 (d00d64d 2020-12-05), and 1.50.0.