Skip to content

Commit df4dd9d

Browse files
fix(server): hidden-edit check reads names with Unicode line separators
The listing parser's `.` skipped U+2028 and U+2029, which git prints raw with core.quotePath=false, so a flagged file with one in its name was never inspected. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7a4db6c commit df4dd9d

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎apps/server/src/storageCleanup.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,20 @@ describe("storage cleanup reports and local file policies", () => {
24402440
}),
24412441
),
24422442
);
2443+
it.live("keeps hidden edits to files named with a Unicode line separator", () =>
2444+
runCleanupTest(
2445+
Effect.gen(function* () {
2446+
const { service, fs, worktree, command } = yield* cleanupFixture();
2447+
const file = "notes
.txt";
2448+
yield* fs.writeFileString(`${worktree}/${file}`, "original\n");
2449+
yield* command(worktree, ["add", file]);
2450+
yield* command(worktree, ["commit", "-m", "notes"]);
2451+
yield* command(worktree, ["update-index", "--assume-unchanged", file]);
2452+
yield* fs.writeFileString(`${worktree}/${file}`, "hidden edit\n");
2453+
expect((yield* service.runNow).entries[0]).toMatchObject({ outcome: "kept" });
2454+
}),
2455+
),
2456+
);
24432457
it.live("removes worktrees whose flagged files are unchanged or outside a sparse checkout", () =>
24442458
runCleanupTest(
24452459
Effect.gen(function* () {

‎apps/server/src/storageCleanup.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ const make = Effect.gen(function* () {
634634
progress: {
635635
onStdoutLine: (line) =>
636636
Effect.sync(() => {
637-
const match = /^(\S) (\d+) ([0-9a-f]+) \d\t(.*)$/.exec(line);
637+
const match = /^(\S) (\d+) ([0-9a-f]+) \d\t(.*)$/s.exec(line);
638638
if (match === null || !hiddenTag.test(match[1]!) || match[2] === "160000") return;
639639
if (flagged.length < 10_000)
640640
flagged.push({ mode: match[2]!, id: match[3]!, file: match[4]! });
@@ -644,7 +644,7 @@ const make = Effect.gen(function* () {
644644
});
645645
if (overflow) return "hidden tracked files exceed the inspection limit";
646646
const reason = (file: string) => `has uncommitted changes hidden from git status (${file})`;
647-
// Git quotes names with control characters, quotes or backslashes, which hash-object cannot read back.
647+
// Git quotes names with control characters, quotes or backslashes, so the listed text is not a path on disk.
648648
const unreadable = flagged.find(({ file }) => file.startsWith('"'));
649649
if (unreadable !== undefined) return reason(unreadable.file);
650650
const onDisk = yield* Effect.forEach(

0 commit comments

Comments
 (0)