cargo: Patching dependencies does not work if it's for the same location but a different branch
E.g.
[patch.'https://github.com/sdroege/gobject-subclass']
gobject-subclass = { git = 'https://github.com/sdroege/gobject-subclass', branch = 'refactoring' }
This gives
error: failed to resolve patches for `https://github.com/sdroege/gobject-subclass`
Caused by:
patch for `gobject-subclass` in `https://github.com/sdroege/gobject-subclass` points to the same source, but patches must point to different sources
About this issue
- Original URL
- State: open
- Created 9 years ago
- Reactions: 84
- Comments: 25 (8 by maintainers)
Commits related to this issue
- remove workaround for https://github.com/rust-lang/cargo/issues/5478 — committed to oxidecomputer/hubris by bcantrill 5 years ago
- kludge: dust off the feat-non-generic branch from 2020 Because of a change in how Cargo normalizes dependency URLs, we are now unable to change the `ut-utp/core` branch that this crate depends On fro... — committed to ut-utp/tm4c-previous by rrbutani 4 years ago
- kludge: dust off the feat-non-generic branch from 2020 Because of a change in how Cargo normalizes dependency URLs, we are now unable to change the `ut-utp/core` branch that this crate depends On fro... — committed to ut-utp/tm4c-previous by rrbutani 4 years ago
- chore: temp fix to quaint due to https://github.com/rust-lang/cargo/issues/5478 — committed to prisma/prisma-engines by jkomyno 4 years ago
- chore: temp fix to quaint due to https://github.com/rust-lang/cargo/issues/5478 — committed to prisma/prisma-engines by jkomyno 4 years ago
- chore: temp fix to quaint due to https://github.com/rust-lang/cargo/issues/5478 — committed to prisma/prisma-engines by jkomyno 4 years ago
- Merge #211 211: Prebuilt Godot artifacts r=Bromeon a=Bromeon Closes #12 Closes #107 From now on, gdext by default fetches pre-generated versions of these files, published in the [`godot4-prebu... — committed to godot-rust/gdext by bors[bot] 4 years ago
- DO NOT MERGE: Bend CI to use 0.9 riot-module-examples branch Note that the `http://` is really intended, as it works around https://github.com/rust-lang/cargo/issues/5478 — committed to RIOT-OS/rust-riot-wrappers by chrysn 2 years ago
- Bump libsignal-service Backports presage commit 35c2c98 to fix connectivity to Signal backend. — committed to hoehermann/purple-presage by webmeister 2 years ago
Nice workaround hack! Further ways to change the URL string include adding
/to the url like https://github.com////user///repo . This method scales to unlimited amounts of different urls for the same repo.These workarounds no longer do it for me (using
cargo 1.52.0)–perhaps Cargo is now normalizing repo names?If anyone is having trouble with overriding SSH URLs, and can’t use HTTPS for whatever reason (eg. private git repo) I found another workaround is to add the port number to the URL, like
ssh://git@github.com:22/<org>/<repo>.gitFor GitHub repositories, one can work around this by
[patch]ing https://github.com/user/repo to https://github.com/user/repo.git (or the other way around).If you want to patch a crate from crates.io with crates.io itself (which often comes up when you just want to change the version), you can do it like this:
This can lead to the same sub-dependency being downloaded from both crates-io and crates-io-2. It’s not a major issue to download the same dependency twice, but just be aware of it.
Have you tried this:
The canonicalization code only strips trailing
/and.git. For extra/inside the URL, it doesn’t do anything.This worked for me (www and .git) :
this bug has been open for a long time. is there hope? we’re stuck with a suboptimal setup due to this.
this has been mentioned already but cargo normalization defeats this feature now it seems. did anyone have a new workaround? @jplatte