fix: Auto-repair stale merge driver configs with invalid placeholders
Old bd versions (<0.24.0) installed merge driver with invalid %L/%R placeholders. Git only supports %O (base), %A (current), %B (other). Changes: - mergeDriverInstalled() now detects %L/%R and returns false to trigger repair - bd init automatically fixes stale configs during initialization - bd doctor --fix also repairs stale configs - Added comprehensive test coverage for auto-repair Fixes: bd-3sz0 Epic: bd-tbz3 (all sub-issues now complete) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -752,7 +752,7 @@ exit 0
|
||||
return nil
|
||||
}
|
||||
|
||||
// mergeDriverInstalled checks if bd merge driver is configured
|
||||
// mergeDriverInstalled checks if bd merge driver is configured correctly
|
||||
func mergeDriverInstalled() bool {
|
||||
// Check git config for merge driver
|
||||
cmd := exec.Command("git", "config", "merge.beads.driver")
|
||||
@@ -761,6 +761,14 @@ func mergeDriverInstalled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if using old invalid placeholders (%L/%R from versions <0.24.0)
|
||||
// Git only supports %O (base), %A (current), %B (other)
|
||||
driverConfig := strings.TrimSpace(string(output))
|
||||
if strings.Contains(driverConfig, "%L") || strings.Contains(driverConfig, "%R") {
|
||||
// Stale config with invalid placeholders - needs repair
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if .gitattributes has the merge driver configured
|
||||
gitattributesPath := ".gitattributes"
|
||||
content, err := os.ReadFile(gitattributesPath)
|
||||
|
||||
Reference in New Issue
Block a user