Skip to content

fix(config): keep config show --full working outside a git repository - #4255

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-35965590465-config-show
Sep 24, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-35965590465-config-show

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Running wt config show --full from 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). Plain wt config show in 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 called Repository::current()? for itself. handle_config_show builds 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 with Repository::current().ok(), so this PR passes that Option<&Repository> into the diagnostics:

  • Outside a repo, the CI-tool check falls through to its existing "CI status requires GitHub, GitLab, Gitea, or Azure DevOps remote" hint.
  • The version check and the commit-generation test still run, with no project identifier.

Inside a repository the output is unchanged.

test_config_show_full_outside_git_repo runs --full from a tempdir and asserts that it exits successfully and that the USER CONFIG and DIAGNOSTICS sections render. It fails on main with the rev-parse error above and passes with this change. The rest of the config_show integration tests (216) and the pre-commit hooks also pass.

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.
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Sep 24, 2026
@max-sixty
max-sixty merged commit bbab727 into main Sep 24, 2026
37 of 47 checks passed
@max-sixty
max-sixty deleted the nightly/clean-35965590465-config-show branch September 24, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants