Repository navigation
fix(config): keep config show --full working outside a git repository - #4255
Merged
Merged
Conversation
render_diagnostics called Repository::current()? itself, so running --full outside a repository failed the whole report with a rev-parse error. Pass the caller's optional repo instead; outside a repo the CI tool check falls back to its hint and the other diagnostics still run.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
wt config show --fullfrom a directory that isn't a git repository threw away the whole report. All the user saw was✗ git rev-parse --git-common-dir failed (exit 128). Plainwt config showin the same directory works: it notes "Not in a git repository" under PROJECT CONFIG and renders every other section.The cause is
render_diagnostics, which calledRepository::current()?for itself.handle_config_showbuilds the whole report in a buffer and pages it at the end, so that one error discarded the USER CONFIG, SHELL and other sections that had already rendered. The caller already resolves the repo withRepository::current().ok(), so this PR passes thatOption<&Repository>into the diagnostics:Inside a repository the output is unchanged.
test_config_show_full_outside_git_reporuns--fullfrom a tempdir and asserts that it exits successfully and that the USER CONFIG and DIAGNOSTICS sections render. It fails onmainwith therev-parseerror above and passes with this change. The rest of theconfig_showintegration tests (216) and the pre-commit hooks also pass.