Fix bd-ng56: add raw string equality short-circuit before jsonEquals

Optimization to avoid JSON unmarshalling when strings match exactly (common case).
Simple 1-line change instead of complex streaming rewrite for P3 issue.
This commit is contained in:
Steve Yegge
2025-11-06 19:41:27 -08:00
parent 244367c351
commit 5c1f441c2a
2 changed files with 3 additions and 3 deletions

View File

@@ -323,8 +323,8 @@ func computeAcceptedDeletions(basePath, leftPath, mergedPath string) ([]string,
for id, baseLine := range baseIndex {
// Issue in base but not in merged
if !mergedIDs[id] {
// Check if unchanged locally using semantic JSON comparison
if leftLine, existsInLeft := leftIndex[id]; existsInLeft && jsonEquals(leftLine, baseLine) {
// Check if unchanged locally - try raw equality first, then semantic JSON comparison
if leftLine, existsInLeft := leftIndex[id]; existsInLeft && (leftLine == baseLine || jsonEquals(leftLine, baseLine)) {
deletions = append(deletions, id)
}
}