This commit is contained in:
Steve Yegge
2025-11-23 20:22:03 -08:00
5 changed files with 149 additions and 600 deletions

View File

@@ -353,6 +353,7 @@ With --no-db: creates .beads/ directory and issues.jsonl file instead of SQLite
green := color.New(color.FgGreen).SprintFunc()
cyan := color.New(color.FgCyan).SprintFunc()
yellow := color.New(color.FgYellow).SprintFunc()
fmt.Printf("\n%s bd initialized successfully!\n\n", green("✓"))
fmt.Printf(" Database: %s\n", cyan(initDBPath))
@@ -752,7 +753,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 +762,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)
@@ -768,9 +777,12 @@ func mergeDriverInstalled() bool {
return false
}
// Look for beads JSONL merge attribute
return strings.Contains(string(content), ".beads/beads.jsonl") &&
// Look for beads JSONL merge attribute (either canonical or legacy filename)
hasCanonical := strings.Contains(string(content), ".beads/issues.jsonl") &&
strings.Contains(string(content), "merge=beads")
hasLegacy := strings.Contains(string(content), ".beads/beads.jsonl") &&
strings.Contains(string(content), "merge=beads")
return hasCanonical || hasLegacy
}
// installMergeDriver configures git to use bd merge for JSONL files