Skip to content

Commit 7d6fec4

Browse files
author
Jerry Xie
committed
fix: don't check dotfiles repo state when URLs are empty
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.
1 parent 7db09da commit 7d6fec4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/diff/compare.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ func diffDotfiles(systemURL, referenceURL string) *DotfilesDiff {
171171
dd.RepoChanged = &ValueChange{System: systemURL, Reference: referenceURL}
172172
}
173173

174+
// Only check local dotfiles repo state if dotfiles are actually configured
175+
// If both URLs are empty, there's no dotfiles setup to check
176+
if sysNorm == "" && refNorm == "" {
177+
return dd
178+
}
179+
174180
// Check local dotfiles repo for dirty state
175181
home, err := os.UserHomeDir()
176182
if err != nil {

0 commit comments

Comments
 (0)