@fern-api/replay 0.10.0 → 0.10.1
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/dist/cli.cjs +14 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1375,7 +1375,7 @@ var ReplayApplicator = class {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
let useAccumulatorAsMergeBase = false;
|
|
1377
1377
|
const accumulatorEntry = this.fileTheirsAccumulator.get(resolvedPath);
|
|
1378
|
-
if (!theirs
|
|
1378
|
+
if (accumulatorEntry && (!theirs || base == null)) {
|
|
1379
1379
|
theirs = await this.applyPatchToContent(
|
|
1380
1380
|
accumulatorEntry.content,
|
|
1381
1381
|
patch.patch_content,
|
|
@@ -1417,12 +1417,16 @@ var ReplayApplicator = class {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
}
|
|
1419
1419
|
if (base == null && !ours && effective_theirs) {
|
|
1420
|
+
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
1421
|
+
content: effective_theirs,
|
|
1422
|
+
baseGeneration: patch.base_generation
|
|
1423
|
+
});
|
|
1420
1424
|
const outDir2 = dirname2(oursPath);
|
|
1421
1425
|
await mkdir(outDir2, { recursive: true });
|
|
1422
1426
|
await writeFile(oursPath, effective_theirs);
|
|
1423
1427
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
1424
1428
|
}
|
|
1425
|
-
if (base == null && ours && effective_theirs) {
|
|
1429
|
+
if (base == null && ours && effective_theirs && !useAccumulatorAsMergeBase) {
|
|
1426
1430
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
1427
1431
|
const outDir2 = dirname2(oursPath);
|
|
1428
1432
|
await mkdir(outDir2, { recursive: true });
|
|
@@ -1605,16 +1609,24 @@ var ReplayApplicator = class {
|
|
|
1605
1609
|
const addedLines = [];
|
|
1606
1610
|
let inTargetFile = false;
|
|
1607
1611
|
let inHunk = false;
|
|
1612
|
+
let isNewFile = false;
|
|
1608
1613
|
let noTrailingNewline = false;
|
|
1609
1614
|
for (const line of lines) {
|
|
1610
1615
|
if (line.startsWith("diff --git")) {
|
|
1611
1616
|
if (inTargetFile) break;
|
|
1612
1617
|
inTargetFile = isDiffLineForFile(line, filePath);
|
|
1613
1618
|
inHunk = false;
|
|
1619
|
+
isNewFile = false;
|
|
1614
1620
|
continue;
|
|
1615
1621
|
}
|
|
1616
1622
|
if (!inTargetFile) continue;
|
|
1623
|
+
if (!inHunk) {
|
|
1624
|
+
if (line === "--- /dev/null" || line.startsWith("new file mode")) {
|
|
1625
|
+
isNewFile = true;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1617
1628
|
if (line.startsWith("@@")) {
|
|
1629
|
+
if (!isNewFile) return null;
|
|
1618
1630
|
inHunk = true;
|
|
1619
1631
|
continue;
|
|
1620
1632
|
}
|