-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo new: option to suppress automatic addition to workspace #14501
Comments
If we're adding relative to Otherwise, we've previously decided that the command is intended for user interactions and not programmatic use and are unlikely to add features for it. |
I'm not sure what the Just to clarify, when you say "adding relative to For example:
Update [workspace]
members = [
"some-workspace"
]
resolver = "2" Then do:
And now [workspace]
members = [ "../outside-root",
"some-workspace"
]
resolver = "2" I understand the decision to prioritize interactive use, but according to what you've said maybe there's a bug here. Version info
|
Sorry, I meant the positional Looks like the code is trying to find the workspace for the manifest but I think we aren't handling cargo/src/cargo/ops/cargo_new.rs Lines 805 to 806 in b687045
We've accepted user input, made it absolute, but never called |
We were correctly doing this for cases like `cargo new foo` or `cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`. This came up when discussing rust-lang#14501
Posted #14505 with a fix for that situation. |
We were correctly doing this for cases like `cargo new foo` or `cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`. This came up when discussing rust-lang#14501
We were correctly doing this for cases like `cargo new foo` or `cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`. This came up when discussing rust-lang#14501
fix(new): Add to workspace relative to manifest, not current-dir ### What does this PR try to resolve? We were correctly doing this for cases like `cargo new foo` or `cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`. This came up when discussing #14501 ### How should we test and review this PR? ### Additional information
We were correctly doing this for cases like `cargo new foo` or `cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`. This came up when discussing rust-lang#14501
Problem
This is similar to but not quite the same as #13985
I'm building a tool which calls
cargo new
as a subprocess. That tool has a rootCargo.toml
which specifies a few workspaces.When testing the tool I do something like
cargo run -- new ../some/path
orcargo run -- new path
. When I do so,cargo new
runs as a subprocess and it indicates that it's adding the new package to the workspace list (even if the folder is outside of the project, i.e. "../"). Because I'm only testing, I want to suppress this behaviour.Without a means to do this, I have to delete the folder, and edit the root
Cargo.toml
every time I test.Proposed Solution
99% of the time it seems correct (and convenient), but I'd like a flag or environment variable to suppress this unexpected automatic behaviour.
Notes
No response
The text was updated successfully, but these errors were encountered: