Skip to content

Adding a registry and version to a local dependency causes dependents over Git to attempt to pull the registry by name #12272

@w4

Description

@w4

Problem

When moving crates to registries that were previously depended on via Git, adding a registry definition to a local dependency causes dependents to attempt to pull the registry, rather than ignoring it and using the local path.

Steps

  1. crate-a containing:
    $ cat Cargo.toml
    [package]
    name = "crate-a"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    some-crate = { path = "../some-crate", registry = "x", version = "0.1" }
    
  2. crate-b containing:
    $ cat Cargo.toml
    [package]
    name = "crate-b"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    crate-a = { git = "https://git.x.com/path/to/crate-a" }
    
  3. Attempting to compile crate-b attempts to pull the x registry rather than ignoring it since it is overridden by the relative path.

When combined with #12271, this prevents any sort of slow migration to registries -- requiring a big bang update to all crates which is untenable for any mid to large sized organisation.

Possible Solution(s)

When depending on a crate using { git = "https://git.x.com/path/to/repo" }, the local dependency should be preferred over the one in the registry.

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crate-dependenciesArea: [dependencies] of any kindA-registriesArea: registriesC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions