-
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
fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' #13479
Conversation
I'm going to add more `config_configure`s and this will make it more obvious that these are done in early returns.
r? @weihanglo rustbot has assigned @weihanglo. Use r? to explicitly pick a reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is that how resilient to broken .cargo/config.toml
these commands should be. Calling config_configure
implies they fail if .cargo/config.toml
is ill-formatted.
Found this with the test for `-Zhelp` in rust-lang#13461.
This was caught in test failures and I've hardened it to make it work
|
Thanks. This looks great 👍🏾 @bors r+ |
☀️ Test successful - checks-actions |
Update cargo 16 commits in 194a60b2952bd5d12ba15dd2577a97eed7d3c587..8964c8ccff6e420e2a38b8696d178d69fab84d9d 2024-02-21 01:53:45 +0000 to 2024-02-27 19:22:46 +0000 - feat: Add "-Zpublic-dependency" for public-dependency feature. (rust-lang/cargo#13340) - Stabilize global cache data tracking. (rust-lang/cargo#13492) - chore: bump baseline version requirement of sub crates (rust-lang/cargo#13494) - fix(doctest): search native libs in build script outputs (rust-lang/cargo#13490) - chore: fixed a typo(two->too) (rust-lang/cargo#13489) - test: relax help text assertion (rust-lang/cargo#13488) - refactor: clean up for `GlobalContext` rename (rust-lang/cargo#13486) - test(cli): Verify terminal styling (rust-lang/cargo#13461) - fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' (rust-lang/cargo#13479) - Error messages when collecting workspace members now mention the workspace root location (rust-lang/cargo#13480) - fix(add): Improve error when adding registry packages while vendored (rust-lang/cargo#13281) - [docs]:Add missing jump links (rust-lang/cargo#13478) - Add global_cache_tracker stability tests. (rust-lang/cargo#13467) - fix(cli): Control clap colors through config (rust-lang/cargo#13463) - chore: remove the unused function (rust-lang/cargo#13472) - Fix missing brackets (rust-lang/cargo#13470)
Update cargo 16 commits in 194a60b2952bd5d12ba15dd2577a97eed7d3c587..8964c8ccff6e420e2a38b8696d178d69fab84d9d 2024-02-21 01:53:45 +0000 to 2024-02-27 19:22:46 +0000 - feat: Add "-Zpublic-dependency" for public-dependency feature. (rust-lang/cargo#13340) - Stabilize global cache data tracking. (rust-lang/cargo#13492) - chore: bump baseline version requirement of sub crates (rust-lang/cargo#13494) - fix(doctest): search native libs in build script outputs (rust-lang/cargo#13490) - chore: fixed a typo(two->too) (rust-lang/cargo#13489) - test: relax help text assertion (rust-lang/cargo#13488) - refactor: clean up for `GlobalContext` rename (rust-lang/cargo#13486) - test(cli): Verify terminal styling (rust-lang/cargo#13461) - fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' (rust-lang/cargo#13479) - Error messages when collecting workspace members now mention the workspace root location (rust-lang/cargo#13480) - fix(add): Improve error when adding registry packages while vendored (rust-lang/cargo#13281) - [docs]:Add missing jump links (rust-lang/cargo#13478) - Add global_cache_tracker stability tests. (rust-lang/cargo#13467) - fix(cli): Control clap colors through config (rust-lang/cargo#13463) - chore: remove the unused function (rust-lang/cargo#13472) - Fix missing brackets (rust-lang/cargo#13470)
fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected ### What does this PR try to resolve? #13479 changed the global context initialization order so that command line stuff is processed after we read some config. This had a side effect of breaking `--config net.git-fetch-with-cli=true`. I reverted the change to restore support for `--config`. Fixes #13991 ### How should we test and review this PR? ### Additional information This reverts commit f525e1f. This removes color control from warnings for unstable features. For some reason this removed color support from `cargo -Zhelp` in the tests but I can't reproduce it locally. The most important thing was getting the config fix in. There are two follow ups - Can we have the config working *and* color? - Why did this fail for this field and not the others we already had tests for? I ran out my immediate time box for looking into these.
What does this PR try to resolve?
Similar to #9012, we aren't respecting
CARGO_TERM_COLOR
for-Zhelp
and other places. This corrects that.How should we test and review this PR?
#9012 was about initialization order to get the value. Here, the problem is that we don't update
Shell
withCARGO_TERM_COLOR
.In doing this, I was concerned about keeping track of where it is safe to call
config_configure
without running it twice. To this end, I refactoredmain
to make it clear that each call toconfig_configure
is in a mutually exclusive path that exists immediately.Additional information
Found this with the test for
-Zhelp
in #13461.