@fern-api/replay 0.15.1 → 0.15.2
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 +2 -64
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -10
- package/dist/index.d.ts +1 -10
- package/dist/index.js +2 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -951,7 +951,7 @@ var ReplayDetector = class {
|
|
|
951
951
|
async detectPatchesInRange(rangeStart, lastGen, lock) {
|
|
952
952
|
const log = await this.git.exec([
|
|
953
953
|
"log",
|
|
954
|
-
"--
|
|
954
|
+
"--no-merges",
|
|
955
955
|
"--format=%H%x00%an%x00%ae%x00%s",
|
|
956
956
|
`${rangeStart}..HEAD`,
|
|
957
957
|
"--",
|
|
@@ -971,18 +971,6 @@ var ReplayDetector = class {
|
|
|
971
971
|
continue;
|
|
972
972
|
}
|
|
973
973
|
const parents = await this.git.getCommitParents(commit.sha);
|
|
974
|
-
if (parents.length > 1) {
|
|
975
|
-
const compositePatch = await this.createMergeCompositePatch({
|
|
976
|
-
mergeCommit: commit,
|
|
977
|
-
firstParent: parents[0],
|
|
978
|
-
lastGen,
|
|
979
|
-
lock
|
|
980
|
-
});
|
|
981
|
-
if (compositePatch) {
|
|
982
|
-
newPatches.push(compositePatch);
|
|
983
|
-
}
|
|
984
|
-
continue;
|
|
985
|
-
}
|
|
986
974
|
let patchContent;
|
|
987
975
|
try {
|
|
988
976
|
patchContent = await this.git.formatPatch(commit.sha);
|
|
@@ -1120,9 +1108,7 @@ var ReplayDetector = class {
|
|
|
1120
1108
|
* within the current linear detection window, and are absent from
|
|
1121
1109
|
* HEAD at the end of the window.
|
|
1122
1110
|
*
|
|
1123
|
-
* Rationale:
|
|
1124
|
-
* firstParent..mergeCommit so net-zero files never enter the composite. On
|
|
1125
|
-
* linear history each commit becomes its own patch, so a file that was
|
|
1111
|
+
* Rationale: each commit becomes its own patch, so a file that was
|
|
1126
1112
|
* briefly added and later removed survives as a create+delete pair whose
|
|
1127
1113
|
* cumulative diff is empty. We drop such patches before they reach the
|
|
1128
1114
|
* lockfile.
|
|
@@ -1189,54 +1175,6 @@ var ReplayDetector = class {
|
|
|
1189
1175
|
return /* @__PURE__ */ new Set();
|
|
1190
1176
|
}
|
|
1191
1177
|
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Create a single composite patch for a merge commit by diffing the merge
|
|
1194
|
-
* commit against its first parent. This captures the net change of the
|
|
1195
|
-
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
1196
|
-
* zero-net-change ghost conflicts.
|
|
1197
|
-
*/
|
|
1198
|
-
async createMergeCompositePatch(input) {
|
|
1199
|
-
const { mergeCommit, firstParent, lastGen, lock } = input;
|
|
1200
|
-
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
1201
|
-
const filesOutput = await this.git.exec([
|
|
1202
|
-
"diff",
|
|
1203
|
-
"--name-only",
|
|
1204
|
-
firstParent,
|
|
1205
|
-
mergeCommit.sha
|
|
1206
|
-
]);
|
|
1207
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
|
|
1208
|
-
if (sensitiveFiles.length > 0) {
|
|
1209
|
-
this.warnings.push(
|
|
1210
|
-
`Sensitive file(s) excluded from merge patch for commit ${mergeCommit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
1211
|
-
);
|
|
1212
|
-
}
|
|
1213
|
-
if (files.length === 0) return null;
|
|
1214
|
-
const diff = await this.git.exec([
|
|
1215
|
-
"diff",
|
|
1216
|
-
firstParent,
|
|
1217
|
-
mergeCommit.sha,
|
|
1218
|
-
"--",
|
|
1219
|
-
...files
|
|
1220
|
-
]);
|
|
1221
|
-
if (!diff.trim()) return null;
|
|
1222
|
-
const contentHash = this.computeContentHash(diff);
|
|
1223
|
-
if (lock.patches.some((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
1224
|
-
return null;
|
|
1225
|
-
}
|
|
1226
|
-
const theirsSnapshot = await capturePatchSnapshot(this.git, files, mergeCommit.sha);
|
|
1227
|
-
return {
|
|
1228
|
-
id: `patch-merge-${mergeCommit.sha.slice(0, 8)}`,
|
|
1229
|
-
content_hash: contentHash,
|
|
1230
|
-
original_commit: mergeCommit.sha,
|
|
1231
|
-
original_message: mergeCommit.message,
|
|
1232
|
-
original_author: `${mergeCommit.authorName} <${mergeCommit.authorEmail}>`,
|
|
1233
|
-
base_generation: lastGen.commit_sha,
|
|
1234
|
-
files,
|
|
1235
|
-
patch_content: diff,
|
|
1236
|
-
...Object.keys(theirsSnapshot).length > 0 ? { theirs_snapshot: theirsSnapshot } : {},
|
|
1237
|
-
...this.isCreationOnlyPatch(diff) ? { user_owned: true } : {}
|
|
1238
|
-
};
|
|
1239
|
-
}
|
|
1240
1178
|
/**
|
|
1241
1179
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
1242
1180
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|