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

Allow a git dependency to resolve for a registry dependency #12983

Closed
vincentdephily opened this issue Nov 16, 2023 · 2 comments
Closed

Allow a git dependency to resolve for a registry dependency #12983

vincentdephily opened this issue Nov 16, 2023 · 2 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@vincentdephily
Copy link

Problem

Dependencies sourced from git are not considered as valid candidates for "normal" dependencies.

Steps

  1. Create a Cargo.toml with env_logger = "0.10.0" and log = "=0.4.15"
  2. Run cargo update and cargo tree
  3. As expected, there is a single copy of the log crate
  4. Switch to log = {git = "https://github.com/rust-lang/log", tag = "0.4.15" }
  5. Run cargo update and cargo tree
  6. We now have two copies of the log crate

Possible Solution(s)

No response

Notes

Might be related to #6921

Version

cargo 1.73.0
release: 1.73.0
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.4.0 (sys:0.4.65+curl-8.2.1 system ssl:rustls-ffi/0.10.0/rustls/0.21.0)
os: Gentoo Linux 2.14 [64-bit]
@vincentdephily vincentdephily added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Nov 16, 2023
@ehuss
Copy link
Contributor

ehuss commented Nov 16, 2023

Thanks for the report! This is intended behavior, since cargo treats crates from different sources as distinct.

The correct way to indicate that you want to replace a registry dependency with one from a git dependency is to use a [patch] table.

@vincentdephily
Copy link
Author

This makes sense, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants