fix: read git identity from XDG config when ~/.gitconfig exists#117
Merged
Conversation
Once gh auth setup-git creates ~/.gitconfig (credential helpers only), `git config --global user.name` reads that file alone and never consults ~/.config/git/config, where setup records the identity. sqrbx-setup then showed blank prompts instead of prefilled name/email, and --list reported "(not set)" despite a configured identity. Fall back to reading the XDG file directly in setup.sh, the sqrbx-setup list view, and install.sh host-side seeding, keeping ~/.gitconfig precedence when it does hold an identity. Add a regression test covering a credential-only ~/.gitconfig alongside an XDG identity. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
On the Unraid tower,
sqrbx-setupshowed blank git name/email prompts andsqrbx-setup --listreported "(not set)" even though the identity was configured. Root cause: oncegh auth setup-gitcreates~/.gitconfig(holding only credential helpers),git config --global user.namereads that file alone and stops consulting~/.config/git/config— the XDG file where setup records the identity. Reproduced on git 2.43 (in-Box) and 2.54.Fix
setup.sh: newcurrent_git_identity()helper —git config --globalfirst (so a real~/.gitconfigidentity keeps precedence), falling back to a direct read of~/.config/git/config; the rerun prefill uses it.scripts/squarebox-setup.sh: same fallback in--list.install.sh: same fallback for host-side seeding (a host with~/.gitconfigplus an XDG-file identity hits the identical gotcha).tests/test-provision-contract.sh: regression test with a credential-only~/.gitconfigalongside an XDG identity, plus contract greps.Verification
🤖 Generated with Claude Code