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

cargo upgrade gets stuck when using sparse registry protocol #868

Open
naturecodevoid opened this issue Aug 8, 2023 · 0 comments
Open

Comments

@naturecodevoid
Copy link

Hi, running cargo upgrade gets stuck when using the sparse registry protocol. (It may be cloning the entire registry, but I'd rather not wait to find out)

The issue is caused here: https://github.com/killercup/cargo-edit/blob/master/src/fetch.rs#L322
cargo-edit uses 0.x of crates-index, which only supports the git registry protocol.

To fix this, all that's needed is to upgrade crates-index to the latest version (2.x) and then detect the registry protocol and use the corresponding Index struct in crates-index.

Some of crates-index's features will need to be enabled: https://docs.rs/crates-index/latest/crates_index/index.html#feature-flags
To determine the struct to use, we need to get the value of this config option: https://doc.rust-lang.org/cargo/reference/config.html#registriescrates-ioprotocol
If the protocol is sparse, this struct should be used: https://docs.rs/crates-index/latest/crates_index/struct.SparseIndex.html
If the protocol is git, this struct should be used: https://docs.rs/crates-index/latest/crates_index/struct.GitIndex.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant