fix: Resolve false positive merge conflict detection in auto-import

- Changed from substring matching to standalone line detection
- Only flags actual Git conflict markers on their own lines
- Prevents false alarms from conflict markers in issue descriptions
- Fixes bd-313

Amp-Thread-ID: https://ampcode.com/threads/T-2acdebf1-e4ce-4534-8538-4e7c4fb84232
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-16 12:22:56 -07:00
parent 32a718dacd
commit 91fdaeee1c
2 changed files with 330 additions and 356 deletions

File diff suppressed because one or more lines are too long

View File

@@ -210,9 +210,13 @@ func autoImportIfNewer() {
}
// Check for Git merge conflict markers (bd-270)
conflictMarkers := []string{"<<<<<<< ", "=======", ">>>>>>> "}
for _, marker := range conflictMarkers {
if bytes.Contains(jsonlData, []byte(marker)) {
// Only match if they appear as standalone lines (not embedded in JSON strings)
lines := bytes.Split(jsonlData, []byte("\n"))
for _, line := range lines {
trimmed := bytes.TrimSpace(line)
if bytes.HasPrefix(trimmed, []byte("<<<<<<< ")) ||
bytes.Equal(trimmed, []byte("=======")) ||
bytes.HasPrefix(trimmed, []byte(">>>>>>> ")) {
fmt.Fprintf(os.Stderr, "\n❌ Git merge conflict detected in %s\n\n", jsonlPath)
fmt.Fprintf(os.Stderr, "The JSONL file contains unresolved merge conflict markers.\n")
fmt.Fprintf(os.Stderr, "This prevents auto-import from loading your issues.\n\n")