Fix remaining Windows test failures

- TestFindBeadsDir_NotFound: Allow finding .beads in parent dirs (e.g., home)
- TestDatabaseReinitialization: Fix git path conversion on Windows
  Git returns Unix-style paths (/c/Users/...) but filepath needs Windows paths
This commit is contained in:
Steve Yegge
2025-11-02 10:01:38 -08:00
parent 1036b0b700
commit 9099032545
2 changed files with 14 additions and 3 deletions

View File

@@ -133,7 +133,16 @@ func findGitRoot() string {
if err != nil {
return ""
}
return string(bytes.TrimSpace(output))
root := string(bytes.TrimSpace(output))
// On Windows, git returns Unix-style paths (/c/Users/...) but we need
// Windows-style paths (C:\Users\...) for filepath.Rel to work correctly
if runtime.GOOS == "windows" && len(root) > 0 && root[0] == '/' {
// Convert /c/Users/... to C:\Users\...
if len(root) >= 3 && root[2] == '/' {
root = string(root[1]) + ":" + filepath.FromSlash(root[2:])
}
}
return root
}
// importFromGit imports issues from git HEAD