Erratic behavior, when [patch]ing Git dependencies #4509
Labels
A-patch
Area: [patch] table override
C-bug
Category: bug
S-needs-info
Status: Needs more info, such as a reproduction or more background for a feature request.
I've encountered some erratic behavior when [patch]ing Git dependencies, when the patched crate is depended on using different Git URLs. All of this is a bit involved, so I don't expect anyone to understand the issue by reading my previous sentence. Please bear with me, I have a full example.
Here's my dependency graph (all dependencies are Git dependencies):
The following details are important:
cargo-patch-test
andcargo-patch-test-other-dependency
depend oncargo-test-patch-dependency
via https://github.com/hannobraun/cargo-patch-test-original-dependency .cargo-patch-test
has a ".git" at the end of the dependency URL,cargo-patch-test-other-dependency
hasn't.cargo-patch-test
overrides its dependency oncargo-test-patch-dependency
using [patch], switching it to https://github.com/hannobraun/cargo-patch-test-override-dependency.git .cargo-patch-test
will fail to build when depending on the original repository, but will work when depending on the overriding repository.I believe the slightly different URLs are what confuses Cargo and lead to the erratic behavior I'm about to describe.
You can follow along at home by checking out the repository:
So here's what happens when I try to test
cargo-patch-test
:It fails to compile, because the [patch] section has no effect (if it's working for you, just try again). Let's run
cargo update
to see if that helps.Looks weird, but ok. Let's try again.
(Update (2018-09-20): Cargo output looks different now, and is not always the same.)
It works! But will it work a second time?
(Update (2018-09-20):
cargo update
no longer fixes the problem for one build. The only time it works for me is for the first build aftergit clone
. Neithercargo update
, norcargo clean
, norrm -rf target
fix the problem for me, which is even weirder.)Nope! It keeps failing from here on out, until I run
cargo update
again.(Update (2018-09-20): It keeps failing from here on out.
cargo update
no longer helps. Only deleting the repository and cloning it again fixes the problem, but only for the first build after the clone.)The text was updated successfully, but these errors were encountered: