fix: resolve symlink paths in autoimport.go for macOS
Both findBeadsDir() and findGitRoot() now use filepath.EvalSymlinks() to resolve to canonical paths before comparison. This fixes the issue where filepath.Rel() fails on macOS because /var is a symlink to /private/var, causing path mismatches. Fixes: TestDatabaseReinitialization failures on macOS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -184,7 +184,12 @@ func findBeadsDir() string {
|
|||||||
for {
|
for {
|
||||||
beadsDir := filepath.Join(dir, ".beads")
|
beadsDir := filepath.Join(dir, ".beads")
|
||||||
if info, err := os.Stat(beadsDir); err == nil && info.IsDir() {
|
if info, err := os.Stat(beadsDir); err == nil && info.IsDir() {
|
||||||
return beadsDir
|
// Resolve symlinks to get canonical path (fixes macOS /var -> /private/var)
|
||||||
|
resolved, err := filepath.EvalSymlinks(beadsDir)
|
||||||
|
if err != nil {
|
||||||
|
return beadsDir // Fall back to unresolved if EvalSymlinks fails
|
||||||
|
}
|
||||||
|
return resolved
|
||||||
}
|
}
|
||||||
|
|
||||||
parent := filepath.Dir(dir)
|
parent := filepath.Dir(dir)
|
||||||
@@ -219,7 +224,13 @@ func findGitRoot() string {
|
|||||||
root = filepath.FromSlash(root)
|
root = filepath.FromSlash(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return root
|
|
||||||
|
// Resolve symlinks to get canonical path (fixes macOS /var -> /private/var)
|
||||||
|
resolved, err := filepath.EvalSymlinks(root)
|
||||||
|
if err != nil {
|
||||||
|
return root // Fall back to unresolved if EvalSymlinks fails
|
||||||
|
}
|
||||||
|
return resolved
|
||||||
}
|
}
|
||||||
|
|
||||||
// importFromGit imports issues from git at the specified ref (bd-0is: supports sync-branch)
|
// importFromGit imports issues from git at the specified ref (bd-0is: supports sync-branch)
|
||||||
|
|||||||
Reference in New Issue
Block a user