TypeScript
fix(server): review rows for nested repositories load in large diffs (#29693)
Alex Southwell2f2e81f6bcf4
diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.tsindex 1cecf781bf7..7d9d68b2856 100644--- a/apps/server/src/vcs/GitVcsDriverCore.test.ts+++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts@@ -2310,6 +2310,9 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {yield* writeTextFile(cwd, "untracked.txt", "new\n");const driver = yield* GitVcsDriver.GitVcsDriver;const nestedCwd = path.join(cwd, "nested");+ const clone = path.join(nestedCwd, "clone");+ yield* fileSystem.makeDirectory(clone);+ yield* initRepoWithCommit(clone);const projectDirectories = [nestedCwd];if (symlinksSupported) {const alias = path.join(directory, "alias");@@ -2323,7 +2326,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {});assert.equal(preview.sources.find((source) => source.kind === "working-tree")!.files!.length,- 2,+ 3,);for (const source of preview.sources) {for (const file of source.files ?? []) {diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.tsindex 107544eacc8..0d1d2c9b1c7 100644--- a/apps/server/src/vcs/GitVcsDriverCore.ts+++ b/apps/server/src/vcs/GitVcsDriverCore.ts@@ -3123,8 +3123,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*{ maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },).pipe(Effect.orElseSucceed(() => null));if (untracked === null) return null;+ // ls-files lists a nested repository with a trailing slash; its diff path has none.const paths = splitNullSeparatedGitStdoutPaths(untracked).filter(- (candidate) => onlyPath === undefined || candidate === onlyPath,+ (candidate) =>+ onlyPath === undefined || candidate === onlyPath || candidate === `${onlyPath}/`,);if (paths.length === 0) return { env: undefined };if (paths.length > REVIEW_UNTRACKED_MAX_FILES) return null;