Commit 6e88e37
authored
workspace: avoid duplicates when pulling dependency from git (#696)
When pulling dependencies using a `patch.crates-io` to a git dependency
like:
```
[dependencies]
sha1 = "0.11.0-rc.0"
[patch.crates-io]
sha1-checked = { git = "https://github.com/RustCrypto/hashes.git" }
```
Cargo will duplicate sha1 dependency:
```
[[package]]
name = "sha1"
version = "0.11.0-rc.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f9318facddf9ac32a33527066936837e189b3f23ced6edc1603720ead5e2b3d"
dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.11.0-rc.0",
]
[[package]]
name = "sha1"
version = "0.11.0-rc.0"
source = "git+https://github.com/RustCrypto/hashes.git#2bcfb5a0a849503ed73b190538787a00c58baada"
dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.11.0-rc.0",
]
[[package]]
name = "sha1-checked"
version = "0.11.0-pre"
source = "git+https://github.com/RustCrypto/hashes.git#2bcfb5a0a849503ed73b190538787a00c58baada"
dependencies = [
"digest 0.11.0-rc.0",
"sha1 0.11.0-rc.0 (git+https://github.com/RustCrypto/hashes.git)",
"zeroize",
]
```
This causes issues further down the line, for example when the
downstream client is built with nix which does not support two copies of
the same crate/version tuple.
This switches the local overrides using a workspace patch instead which
are not used when the crate is consumed via git.1 parent 2bcfb5a commit 6e88e37
4 files changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
0 commit comments