fix: isolate diff tests from local dotfiles repo state#22
Open
jerryjrxie wants to merge 3 commits intoopenbootdotdev:mainfrom
Open
fix: isolate diff tests from local dotfiles repo state#22jerryjrxie wants to merge 3 commits intoopenbootdotdev:mainfrom
jerryjrxie wants to merge 3 commits intoopenbootdotdev:mainfrom
Conversation
The previous implementation only checked --global git config, but users may have their git identity configured in: - Local repository config (.git/config) - System config (/etc/gitconfig) - Other scopes This change first tries --global, then falls back to checking all scopes if --global returns empty. This ensures we detect git configuration regardless of where it's set. Closes git config detection issue
Adds TestGetGitConfig_FallsBackToAnyScope to verify that GetGitConfig checks all git config scopes (global, local, system) when looking for user.name and user.email, not just --global. Related to git config detection issue
The diffDotfiles function was always checking the local ~/.dotfiles git state, even when comparing snapshots with empty dotfiles URLs. This caused test failures when the user's actual dotfiles repo had uncommitted changes. Fix: Only check dotfiles repo state if at least one URL is configured. If both system and reference have empty dotfiles URLs, skip the git state check entirely. This makes the tests deterministic and not dependent on the user's local dotfiles repo state.
|
👋 Thanks for opening this pull request! 🎉 This is your first PR to OpenBoot — welcome! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
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.
Summary
Fixes test isolation issue where diff tests failed depending on the user's local ~/.dotfiles git state.
Problem
diffDotfiles()always checked the actual~/.dotfilesgit repository for uncommitted changes, even when comparing snapshots with empty dotfiles URLs. This caused tests to fail unpredictably when the user's dotfiles repo had local changes.Solution
Only check the local dotfiles repo state if at least one dotfiles URL is configured. If both system and reference have empty dotfiles URLs, skip the git state check entirely.
Changes
Impact
Testing
make test-unit