@fern-api/replay 0.17.4 → 0.18.0
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 +32 -19
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +32 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -5379,6 +5379,11 @@ var init_GitClient = __esm({
|
|
|
5379
5379
|
proc.stderr.on("data", (data) => {
|
|
5380
5380
|
stderr += data.toString();
|
|
5381
5381
|
});
|
|
5382
|
+
proc.on("error", (err) => {
|
|
5383
|
+
reject(new Error(`git ${args.join(" ")} failed to spawn: ${err.message}`));
|
|
5384
|
+
});
|
|
5385
|
+
proc.stdin.on("error", () => {
|
|
5386
|
+
});
|
|
5382
5387
|
proc.on("close", (code) => {
|
|
5383
5388
|
if (code === 0) {
|
|
5384
5389
|
resolve2(stdout);
|
|
@@ -14981,7 +14986,8 @@ function parseRevertedMessage(subject) {
|
|
|
14981
14986
|
var INFRASTRUCTURE_FILES = /* @__PURE__ */ new Set([".fernignore"]);
|
|
14982
14987
|
function matchesFernignorePattern(filePath, patterns) {
|
|
14983
14988
|
if (patterns.length === 0) return false;
|
|
14984
|
-
return patterns.some((
|
|
14989
|
+
return patterns.some((rawPattern) => {
|
|
14990
|
+
const p = rawPattern.endsWith("/") ? rawPattern.slice(0, -1) : rawPattern;
|
|
14985
14991
|
if (filePath === p) return true;
|
|
14986
14992
|
if (minimatch(filePath, p)) return true;
|
|
14987
14993
|
if (!p.includes("*") && !p.includes("?") && filePath.startsWith(p + "/")) return true;
|
|
@@ -15160,20 +15166,15 @@ var ReplayDetector = class {
|
|
|
15160
15166
|
continue;
|
|
15161
15167
|
}
|
|
15162
15168
|
const parents = await this.git.getCommitParents(commit.sha);
|
|
15163
|
-
let
|
|
15169
|
+
let filesOutput;
|
|
15164
15170
|
try {
|
|
15165
|
-
|
|
15171
|
+
filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
15166
15172
|
} catch {
|
|
15167
15173
|
this.warnings.push(
|
|
15168
15174
|
`Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
|
|
15169
15175
|
);
|
|
15170
15176
|
continue;
|
|
15171
15177
|
}
|
|
15172
|
-
let contentHash = this.computeContentHash(patchContent);
|
|
15173
|
-
if (lock.patches.find((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
15174
|
-
continue;
|
|
15175
|
-
}
|
|
15176
|
-
const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
15177
15178
|
const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
|
|
15178
15179
|
filesOutput,
|
|
15179
15180
|
this.fernignorePatterns
|
|
@@ -15188,19 +15189,31 @@ var ReplayDetector = class {
|
|
|
15188
15189
|
`.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
|
|
15189
15190
|
);
|
|
15190
15191
|
}
|
|
15191
|
-
if (
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15192
|
+
if (files.length === 0) {
|
|
15193
|
+
continue;
|
|
15194
|
+
}
|
|
15195
|
+
const wasFiltered = sensitiveFiles.length > 0 || fernignoredFiles.length > 0;
|
|
15196
|
+
const parentSha = parents[0];
|
|
15197
|
+
let patchContent;
|
|
15198
|
+
if (wasFiltered && parentSha) {
|
|
15199
|
+
try {
|
|
15200
|
+
patchContent = await this.git.exec(["diff", parentSha, commit.sha, "--", ...files]);
|
|
15201
|
+
} catch {
|
|
15202
|
+
continue;
|
|
15203
|
+
}
|
|
15204
|
+
if (!patchContent.trim()) continue;
|
|
15205
|
+
} else {
|
|
15206
|
+
try {
|
|
15207
|
+
patchContent = await this.git.formatPatch(commit.sha);
|
|
15208
|
+
} catch {
|
|
15209
|
+
this.warnings.push(
|
|
15210
|
+
`Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
|
|
15211
|
+
);
|
|
15212
|
+
continue;
|
|
15201
15213
|
}
|
|
15202
15214
|
}
|
|
15203
|
-
|
|
15215
|
+
const contentHash = this.computeContentHash(patchContent);
|
|
15216
|
+
if (lock.patches.find((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
15204
15217
|
continue;
|
|
15205
15218
|
}
|
|
15206
15219
|
const theirsSnapshot = await capturePatchSnapshot(this.git, files, commit.sha);
|