@devries-cameron20 / t3code Mirror · read-only / commits / 3cbc0a4f61
Fork 0

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 21, 13:30 UTC

perf(server): skip the full untracked scan when Git status shows none (#36870)

Julius Marminge committed Nov 14, 2026 at 11:00 UTC 3cbc0a4f61e55ee50a4d489b4eedc72891badec5
2 files changed +22 -2
apps/server/src/vcs/GitVcsDriverCore.test.ts
+7
@@ -4637,6 +4637,13 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4637 yield* git(cwd, ["checkout", "-b", "feature/many-untracked"]);
4638 yield* writeTextFile(cwd, ".git/info/exclude", "ignored.txt\n");
4639 yield* writeTextFile(cwd, "bulk[1]/ignored.txt", "ignored\n");
4640 + const clean = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
4641 + assert.deepStrictEqual(clean.branchChanges, {
4642 + baseRef: "main",
4643 + insertions: 0,
4644 + deletions: 0,
4645 + });
4646 + assert.deepStrictEqual(untrackedScanRoots, []);
4647 yield* Effect.forEach(
4648 Array.from({ length: 1_001 }, (_, index) => `bulk[1]/${index}.txt`),
4649 (file) => writeTextFile(cwd, file, "one\ntwo\n"),
apps/server/src/vcs/GitVcsDriverCore.ts
+15 -2
@@ -631,6 +631,11 @@ export function isNonRepositoryGitStderr(stderr: string): boolean {
631 const normalized = stderr.toLowerCase();
632 return NON_REPOSITORY_STDERR_PHRASES.some((phrase) => normalized.includes(phrase));
633 }
634 +// Unknown spellings count as hidden so their untracked files are still found by a full scan.
635 +const UNTRACKED_FILES_SHOWN_CONFIG_VALUES = new Set(["normal", "all", "true", "yes", "on", "1"]);
636 +function untrackedFilesHiddenByConfig(value: string | null): boolean {
637 + return value !== null && !UNTRACKED_FILES_SHOWN_CONFIG_VALUES.has(value.toLowerCase());
638 +}
639 function isUnbornHeadStderr(stderr: string): boolean {
640 const normalized = stderr.toLowerCase();
641 return (
@@ -3771,8 +3776,16 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3776 detail: remembered.detail,
3777 });
3778 }
3774 - // Empty status can mean untracked files are hidden; retain the full scan.
3775 - const untracked = yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs, undefined, false);
3779 + // Empty status means no untracked files unless config hides them; then scan the whole tree.
3780 + const untracked =
3781 + roots.length === 0 &&
3782 + !untrackedFilesHiddenByConfig(
3783 + yield* readConfigValue(cwd, "status.showUntrackedFiles").pipe(
3784 + Effect.orElseSucceed(() => "no"),
3785 + ),
3786 + )
3787 + ? { env: undefined, omitted: false }
3788 + : yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs, undefined, false);
3789 if ("unavailable" in untracked) {
3790 const count = remembered?.roots === rootsKey ? remembered.count + 1 : 1;
3791 untrackedTotalsFailures.delete(cwd);