Skip to content

Commit eb94328

Browse files
committed
fix(checkpoint): retain rediscovered rebase resolutions
1 parent 351ba53 commit eb94328

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎apps/server/src/checkpointing/CheckpointStore.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,33 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {
569569
yield* git(upstream, ["branch", "other", "agent"]);
570570
yield* git(tmp, ["fetch", "upstream"], { committedAt: afterCheckpoint });
571571
expect(yield* checkpointStore.listAuthoredPaths(refs)).toEqual(new Set(["own.txt"]));
572+
573+
yield* writeTextFile(NodePath.join(tmp, "upstream.txt"), "local\n");
574+
yield* git(tmp, ["add", "."]);
575+
yield* git(tmp, ["commit", "-m", "local conflict"], { committedAt: afterCheckpoint });
576+
yield* writeTextFile(NodePath.join(upstream, "upstream.txt"), "remote\n");
577+
yield* git(upstream, ["add", "."]);
578+
yield* git(upstream, ["commit", "-m", "remote conflict"], { committedAt: afterCheckpoint });
579+
yield* git(tmp, ["fetch", "upstream"], { committedAt: afterCheckpoint });
580+
yield* git(tmp, ["rebase", `upstream/${branch}`], {
581+
committedAt: afterCheckpoint,
582+
allowNonZeroExit: true,
583+
});
584+
expect(yield* git(tmp, ["diff", "--name-only", "--diff-filter=U"])).toBe("upstream.txt");
585+
yield* writeTextFile(NodePath.join(tmp, "upstream.txt"), "resolved\n");
586+
yield* git(tmp, ["add", "upstream.txt"]);
587+
yield* git(tmp, ["-c", "core.editor=true", "rebase", "--continue"], {
588+
committedAt: afterCheckpoint,
589+
});
590+
yield* git(tmp, ["push", "upstream", "HEAD:refs/heads/resolved"], {
591+
committedAt: afterCheckpoint,
592+
});
593+
yield* git(upstream, ["branch", "rediscovered", "resolved"]);
594+
yield* git(tmp, ["fetch", "upstream"], { committedAt: afterCheckpoint });
595+
yield* checkpointStore.captureCheckpoint({ cwd: tmp, checkpointRef: refs.toCheckpointRef });
596+
expect(yield* checkpointStore.listAuthoredPaths(refs)).toEqual(
597+
new Set(["own.txt", "upstream.txt"]),
598+
);
572599
}),
573600
);
574601

‎apps/server/src/vcs/GitVcsDriver.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ it("treats only reflog entries that create local commits as local", () => {
110110
"pull (pick): own",
111111
"pull --rebase origin main (pick): own",
112112
"rebase (pick): own",
113+
"rebase (continue): own",
114+
"rebase (merge): own",
113115
"merge upstream/main: Merge made by the 'ort' strategy.",
114116
];
115117
const fetched = [

‎apps/server/src/vcs/GitVcsDriver.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ const CHECKPOINT_RECOVERY_TIMEOUT = "5 seconds";
449449
const GIT_CHECK_IGNORE_MAX_STDIN_BYTES = 256 * 1024;
450450
// HEAD reflog subjects of operations that create commits. Fast-forwards are imports, so excluded.
451451
export const LOCAL_COMMIT_REFLOG_SUBJECT =
452-
/^(?:(?:commit(?: \([^)]*\))?|cherry-pick|revert|(?:rebase|pull(?: .*)?) \((?:pick|reword|edit|squash|fixup)\)): |(?:merge .*|pull(?: .*)?): Merge made by )/;
452+
/^(?:(?:commit(?: \([^)]*\))?|cherry-pick|revert|(?:rebase|pull(?: .*)?) \((?:pick|reword|edit|squash|fixup|continue|merge)\)): |(?:merge .*|pull(?: .*)?): Merge made by )/;
453453
const WORKSPACE_GIT_HARDENED_CONFIG_ARGS = [
454454
"-c",
455455
"core.fsmonitor=false",

0 commit comments

Comments
 (0)