killercup / killercup/cargo-edit

cargo upgrade fails when replacing crates-io with another registry

Open
#865 1 comment 8 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
166
PR merge metrics
No merged PRs in 30d

Description

Hello, I am not using crates-io, my `config.toml` looks like this:

```
[registries]
my-registry = { index = "sparse+https://" }

[source.crates-io]
replace-with = "my-registry"
```

I can build fine with `cargo build`, `cargo update` works fine to update my `Cargo.lock` file, but running `cargo upgrade -v` is failing with this error:

`Error: The repo at path ....\.cargo\registry\index\ is unusable due to having an invalid HEAD reference: reference 'refs/heads/master' not found; class=Reference (4); code=NotFound (-3)`

Any ideas on what I could do to get past this problem?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `cargo upgrade -v` with the shown `config.toml` and replacement registry, then compare its registry handling with the successful `cargo build` and `cargo update` commands. Done means dependency upgrades work without the invalid HEAD reference error when crates.io is replaced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.