resulgit 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/resulgit.js +16 -2
package/package.json
CHANGED
package/resulgit.js
CHANGED
|
@@ -1406,15 +1406,29 @@ async function cmdPush(opts) {
|
|
|
1406
1406
|
const merged = {}
|
|
1407
1407
|
const paths = new Set([...Object.keys(base), ...Object.keys(remote.files), ...Object.keys(local).map(k => k)])
|
|
1408
1408
|
spinnerUpdate(spinner, 'Merging changes...')
|
|
1409
|
+
|
|
1410
|
+
// Helper to check if content has unresolved conflict markers
|
|
1411
|
+
const hasConflictMarkers = (content) => {
|
|
1412
|
+
if (!content) return false
|
|
1413
|
+
return content.includes('<<<<<<<') && content.includes('=======') && content.includes('>>>>>>>')
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1409
1416
|
for (const p of paths) {
|
|
1410
1417
|
const b = p in base ? base[p] : null
|
|
1411
1418
|
const r = p in remote.files ? remote.files[p] : null
|
|
1412
1419
|
const l = p in local ? local[p].content : null
|
|
1413
1420
|
const changedLocal = String(l) !== String(b)
|
|
1414
1421
|
const changedRemote = String(r) !== String(b)
|
|
1415
|
-
|
|
1422
|
+
|
|
1423
|
+
// Check if local file has conflict markers (unresolved)
|
|
1424
|
+
if (l && hasConflictMarkers(l)) {
|
|
1416
1425
|
const line = firstDiffLine(l || '', r || '')
|
|
1417
|
-
conflicts.push({ path: p, line })
|
|
1426
|
+
conflicts.push({ path: p, line, reason: 'Unresolved conflict markers in file' })
|
|
1427
|
+
} else if (changedLocal && changedRemote && String(l) !== String(r)) {
|
|
1428
|
+
// Both changed and different - but if local is the "resolved" version, use it
|
|
1429
|
+
// This happens when user resolved a conflict and is pushing the resolution
|
|
1430
|
+
// The local version wins if it doesn't have conflict markers
|
|
1431
|
+
if (l !== null) merged[p] = l
|
|
1418
1432
|
} else if (changedLocal && !changedRemote) {
|
|
1419
1433
|
// Local changed, use local version
|
|
1420
1434
|
if (l !== null) merged[p] = l
|