The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 23:15 UTC
perf(server): untracked change totals use less CPU (#19676)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Jet committed
Oct 19, 2026 at 21:16 UTC
cfbd463110d4fda9e662a18639caa3518eb0cbf4
2 files changed
+31
apps/server/src/vcs/GitVcsDriverCore.test.ts
+28
@@ -3221,6 +3221,34 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
3221
}),
3222
);
3223
3224
+ it.effect(
3225
+ "counts many untracked files exactly while collapsing their directory in status",
3226
+ () =>
3227
+ Effect.gen(function* () {
3228
+ const cwd = yield* makeTmpDir();
3229
+ yield* initRepoWithCommit(cwd);
3230
+ const driver = yield* GitVcsDriver.GitVcsDriver;
3231
+ yield* git(cwd, ["branch", "-M", "main"]);
3232
+ yield* git(cwd, ["checkout", "-b", "feature/many-untracked"]);
3233
+ yield* Effect.forEach(
3234
+ Array.from({ length: 1_001 }, (_, index) => `bulk/${index}.txt`),
3235
+ (file) => writeTextFile(cwd, file, "one\ntwo\n"),
3236
+ { concurrency: 32, discard: true },
3237
+ );
3238
+
3239
+ const status = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
3240
+ assert.deepStrictEqual(status.branchChanges, {
3241
+ baseRef: "main",
3242
+ insertions: 2_002,
3243
+ deletions: 0,
3244
+ });
3245
+ assert.deepStrictEqual(
3246
+ status.workingTree.files.map((file) => file.path),
3247
+ ["bulk/"],
3248
+ );
3249
+ }),
3250
+ );
3251
+
3252
it.effect("reports non-repository directories without failing", () =>
3253
Effect.gen(function* () {
3254
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+3
@@ -2861,6 +2861,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2861
cwd,
2862
[
2863
...tempIndexConfig,
2864
+ // Avoid redundant tracked-entry pathspec matching in this disposable index.
2865
+ "-c",
2866
+ "core.preloadIndex=false",
2867
"--literal-pathspecs",
2868
"add",
2869
"--intent-to-add",