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

Select specific workspace package in --git overrides #107

Open
eopb opened this issue Sep 2, 2024 · 2 comments
Open

Select specific workspace package in --git overrides #107

eopb opened this issue Sep 2, 2024 · 2 comments

Comments

@eopb
Copy link
Owner

eopb commented Sep 2, 2024

Problem

When creating a git override with cargo-overrides --git <uri> flag, a URL is provided for the git repository. If that git repository happens to contain a workspace, cargo-override will use the default package in that workspace.

For example, since sqlx defines a default package at its root, it'll be that crate that gets patched when cargo override --git https://github.com/launchbadge/sqlx is used. It is not currently possible to patch an of the other sqlx crates with --git, such as sqlx-core.

Crates like tokio and tracing, don't contain any default package in their workspace root, so aren't possible to patch at all. cargo override --git currently always fails for those.

Suggested solution

First we need to ensure that git patches of crates, without a default package, are possible with Cargo. I have not tested this so am not 100% certain it works.

Once that is done, we can add a -p <pkgid> flag that can be used with --git to specify the package we wish to use in the patch.

@eopb
Copy link
Owner Author

eopb commented Sep 2, 2024

It could also make sense to generalise this change to work with --path also, since the path could also contain multiple packages in a workspace.

This is also a nice opportunity to have improved error/help messages, where we print out package IDs of the potential packages that can be passed into -p <pkgid>

@epage
Copy link
Contributor

epage commented Sep 5, 2024

My recommendation would be to act like cargo.

--path maps to a PathSource which expects a package at that location.

--git maps to a GitSource which wraps a RecursivePathSource. I would patch everything found within the GitSource that is present in the Resolve, warning when a referenced package name is ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants