TypeScript
fix(server): diffs keep submodule changes under diff.submodule=log (#29852)
Alex Southwell0673e7e61046
diff --git a/apps/server/src/checkpointing/CheckpointStore.test.ts b/apps/server/src/checkpointing/CheckpointStore.test.tsindex 51c461d4a6d..36e58024adb 100644--- a/apps/server/src/checkpointing/CheckpointStore.test.ts+++ b/apps/server/src/checkpointing/CheckpointStore.test.ts@@ -159,6 +159,10 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {yield* initRepoWithCommit(tmp);yield* git(tmp, ["config", "diff.noprefix", "true"]);yield* git(tmp, ["config", "diff.suppressBlankEmpty", "true"]);+ yield* git(tmp, ["config", "diff.submodule", "log"]);+ const sub = NodePath.join(tmp, "sub");+ yield* git(tmp, ["init", "sub"]);+ yield* initRepoWithCommit(sub);const checkpointStore = yield* CheckpointStore.CheckpointStore;const threadId = ThreadId.make("thread-checkpoint-store-noprefix");const fromCheckpointRef = checkpointRefForThreadTurn(threadId, 0);@@ -170,6 +174,7 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {checkpointRef: fromCheckpointRef,});yield* writeTextFile(NodePath.join(tmp, "README.md"), "# test\n\nafter\n");+ yield* git(sub, ["commit", "--allow-empty", "-m", "moved"]);yield* checkpointStore.captureCheckpoint({cwd: tmp,checkpointRef: toCheckpointRef,@@ -184,6 +189,8 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {expect(diff).toContain("diff --git a/README.md b/README.md");expect(diff).toContain(" # test\n \n-before\n+after\n");+ expect(diff).toContain("diff --git a/sub b/sub");+ expect(diff).toContain("+Subproject commit ");}),);diff --git a/apps/server/src/vcs/GitVcsDriver.ts b/apps/server/src/vcs/GitVcsDriver.tsindex 42459d8450a..48f1f56b9b0 100644--- a/apps/server/src/vcs/GitVcsDriver.ts+++ b/apps/server/src/vcs/GitVcsDriver.ts@@ -1428,6 +1428,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ("--no-color","--no-ext-diff","--no-textconv",+ "--submodule=short",...PATCH_RENDER_PREFIX_ARGS,...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),`${fromRevision}^{commit}`,diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.tsindex 0d1d2c9b1c7..5e5aaa0fddc 100644--- a/apps/server/src/vcs/GitVcsDriverCore.ts+++ b/apps/server/src/vcs/GitVcsDriverCore.ts@@ -81,7 +81,7 @@ const REVIEW_BRANCH_SUBJECT_LIMIT = 300;const REVIEW_BRANCH_COMMIT_MAX_OUTPUT_BYTES = 128 * 1024;// Client patch parsers require a/ and b/ prefixes; override user diff prefix settings.export const PATCH_RENDER_PREFIX_ARGS = ["--src-prefix=a/", "--dst-prefix=b/"] as const;-// Client patch parsers drop blank context lines that diff.suppressBlankEmpty prints without a space.+// Client patch parsers drop blank context lines under diff.suppressBlankEmpty and summaries under diff.submodule.const REVIEW_DIFF_ARGS = ["-c","diff.suppressBlankEmpty=false",@@ -90,6 +90,7 @@ const REVIEW_DIFF_ARGS = ["--no-color","--no-ext-diff","--no-textconv",+ "--submodule=short",...PATCH_RENDER_PREFIX_ARGS,];const STATUS_UPSTREAM_REFRESH_INTERVAL = Duration.seconds(15);