The best way to control Claude Code, Codex and more from any computer or phone
fix(server): include untracked files when Git config hides them (#23134)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Victor committed
Nov 14, 2026 at 16:42 UTC
852f53b801ac2ae71788780d89fd9c3ab340ce88
2 files changed
+18
-11
apps/server/src/vcs/GitVcsDriverCore.test.ts
+9
-3
@@ -4152,7 +4152,11 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4152
// Base config reads start only after status completes; hold every one until the rename lands.
4153
const spawner = ChildProcessSpawner.make((command) =>
4154
Effect.gen(function* () {
4155
- if (ChildProcess.isStandardCommand(command) && command.args[0] === "config") {
4155
+ if (
4156
+ ChildProcess.isStandardCommand(command) &&
4157
+ command.args[0] === "config" &&
4158
+ !command.args.includes("status.showUntrackedFiles")
4159
+ ) {
4160
if (!(yield* Ref.getAndSet(renameClaimed, true))) {
4161
yield* git(cwd, ["branch", "-m", "t3/temporary", "feature/named"]).pipe(
4162
Effect.provideService(GitVcsDriver.GitVcsDriver, outer),
@@ -4668,13 +4672,15 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4672
deletions: 0,
4673
});
4674
assert.deepStrictEqual(untrackedScanRoots, [
4671
- scenario === "normal" ? [":(top,literal)bulk[1]/"] : [],
4675
+ scenario === "normal" || scenario === "no" ? [":(top,literal)bulk[1]/"] : [],
4676
]);
4673
- if (scenario === "normal") {
4677
+ if (scenario === "normal" || scenario === "no") {
4678
assert.deepStrictEqual(
4679
status.workingTree.files.map((file) => file.path),
4680
["bulk[1]/"],
4681
);
4682
+ } else if (scenario === "all") {
4683
+ assert.lengthOf(status.workingTree.files, 1_001);
4684
}
4685
}
4686
}),
apps/server/src/vcs/GitVcsDriverCore.ts
+9
-8
@@ -631,7 +631,6 @@ 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.
634
const UNTRACKED_FILES_SHOWN_CONFIG_VALUES = new Set(["normal", "all", "true", "yes", "on", "1"]);
635
function untrackedFilesHiddenByConfig(value: string | null): boolean {
636
return value !== null && !UNTRACKED_FILES_SHOWN_CONFIG_VALUES.has(value.toLowerCase());
@@ -2302,11 +2301,18 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2301
options?: GitVcsDriver.GitLocalStatusOptions,
2302
) {
2303
const includeDivergence = options?.includeDivergence !== false;
2304
+ // Hidden untracked files could not be committed; `all` stays as configured.
2305
+ const untrackedFilesHidden = untrackedFilesHiddenByConfig(
2306
+ yield* readConfigValue(cwd, "status.showUntrackedFiles").pipe(
2307
+ Effect.orElseSucceed(() => null),
2308
+ ),
2309
+ );
2310
const statusArgs = [
2311
"status",
2312
"--porcelain=2",
2313
"--branch",
2314
"-z",
2315
+ ...(untrackedFilesHidden ? ["--untracked-files=normal"] : []),
2316
...(includeDivergence ? [] : ["--no-ahead-behind"]),
2317
];
2318
const indexResult = yield* executeGitWithStableDiagnostics(
@@ -3776,14 +3782,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3782
detail: remembered.detail,
3783
});
3784
}
3779
- // Empty status means no untracked files unless config hides them; then scan the whole tree.
3785
+ // Status always lists untracked files, so no roots means there are none to scan.
3786
const untracked =
3781
- roots.length === 0 &&
3782
- !untrackedFilesHiddenByConfig(
3783
- yield* readConfigValue(cwd, "status.showUntrackedFiles").pipe(
3784
- Effect.orElseSucceed(() => "no"),
3785
- ),
3786
- )
3787
+ roots.length === 0
3788
? { env: undefined, omitted: false }
3789
: yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs, undefined, false);
3790
if ("unavailable" in untracked) {