fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp'#13479
fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp'#13479bors merged 5 commits intorust-lang:masterfrom
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 |
weihanglo
left a comment
There was a problem hiding this comment.
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_COLORfor-Zhelpand 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
ShellwithCARGO_TERM_COLOR.In doing this, I was concerned about keeping track of where it is safe to call
config_configurewithout running it twice. To this end, I refactoredmainto make it clear that each call toconfig_configureis in a mutually exclusive path that exists immediately.Additional information
Found this with the test for
-Zhelpin #13461.