Skip to content

git dependency revs do not affect crate resolution as I might expect #6921

Open

Description

TiKV is a workspace consisting of a number of crates. Many of those crates depend on other crates that are only available as git dependencies, and those git deps are depended on by multiple crates in the workspace.

e.g. tikv the library has a tipb = { git = "https://github.com/pingcap/tipb.git" } dependency, and so does the cop_datatype crate in the same workspace.

There are many instances of this in the workspace. Each git dep must be resolved to an exact rev or the build will break. Today those revs are specified only in the workspace lockfile and not in the manifests, where they should be (if someone were to completely regenerate the lockfile or use tikv or any of its libraries as libraries the build would fail).

In trying to move the git revs into the manifest it is clear that rev must be specified for every crate that depends on it. I had hoped that specifying the rev in a single place would "narrow" the selection of every instance of that git dep to the same revision, but instead we see multiple versions of the git deps being selected.

That is I would like to write in the tikv manifest tipb = { git = "https://github.com/pingcap/tipb.git", rev = "abdce" }, while leaving all the other manifests tipb = { git = "https://github.com/pingcap/tipb.git" } and have them resolve to the same crate.

So the end result is that every crate in the workspace that shares a git dep must independently specify the same revision, and so far there is no appetite to do that in the project.

(On the other hand, I can easily see how every crate should specify the version it needs since every crate can be published and used independently. But still, it would be more palatable for my present use case if "no rev" was like "rev=*" and all the identical git repos resolved to the most specific).

We also tried using [patch] for this purpose, which doesn't seem quite what it's intended for, and ran into #5478. So right now it looks to me that if we want to move the "rev" requirement out of the lockfile we must duplicate the rev in every project with the same git dep.

So I'm sure "rev" will ever work this way, but I am raising the issue to see if there are any suggestions how to specify the rev in a single place outside of the lockfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitArea: anything dealing with gitC-enhancementCategory: enhancementCategory: enhancementS-needs-rfcStatus: Needs an RFC to make progress.Status: Needs an RFC to make progress.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions