fix(server): file listing keeps gitignore status when a filename looks like a git pathspec #42333
main fromrefs/pull/42333/head·merged by juliusmarminge View on GitHubProblem#
When the repository root has a file whose name starts with : and reads as Git pathspec magic, such as :(draft).md, the Files panel shows gitignored files listed with it (such as ignored.log) as normal files instead of greying them out. git check-ignore --stdin exits 128 on that name (fatal: Invalid pathspec magic 'draft' in ':(draft).md'), so the listing loses every ignored label in the batch that holds it.
Change#
checkIgnore in apps/server/src/workspace/WorkspaceEntries.ts now prefixes each stdin path with ./, since pathspec magic only applies to a leading :. Because Git echoes each path as given, the loop strips ./ from returned paths before matching entries. --literal-pathspecs, GIT_LITERAL_PATHSPECS, and :(literal) are not used because git check-ignore rejects them for every path (exit 128: pathspec magic not supported by this command: 'literal'). I also let wide folders whose name starts with : use the one-call shortcut, since the : exclusion only existed for the same problem (only glob characters still skip it); in apps/server/src/workspace/WorkspaceEntries.test.ts, the existing root-listing test now includes a :(draft).md file and the wide-folder test checks a :-named folder's labels.
Scope#
Bug fix for wrong data (missing ignored labels in folder listings). No issue: this is a small fix for an obvious bug where one file name at the repository root silently drops gitignore labels for the files listed with it.
Verification#
Steps (Linux): git init demo-project, add .gitignore (*.log), create ignored.log, notes.md, README.md, and :(draft).md → add the folder as a project → open the right panel → Files.
Setup: Linux (Ubuntu 26.04), web client in T3's built-in browser panel, light theme, 1280x800 viewport, fresh isolated dev data per commit (vp run dev --no-seed), synthetic demo repo, server named "Test machine".
| e3ff780 | 4d1dab2 |
|---|---|
![]() ignored.log looks like a normal file next to :(draft).md | ![]() ignored.log is greyed out as gitignored next to :(draft).md |
Tests (Node 26.13.1): On e3ff780, the root-listing test and the wide-folder test fail; on 4d1dab2, WorkspaceEntries.test.ts passes 35/35 three times and vp run check:changed against e3ff780 passes.
Merged tree: 4d1dab2's parent is e3ff780, the newest green main when checked, so the head is the merged tree.
Test output
# e3ff780 — WorkspaceEntries.test.ts on base source
FAIL |t3| src/workspace/WorkspaceEntries.test.ts > WorkspaceEntries > list > lists immediate children including ignored and empty directories
AssertionError: expected [ Array(8) ] to deeply equal ArrayContaining{…}
- Expected
+ Received
- ArrayContaining [
+ [
{
- "ignored": true,
"kind": "file",
"path": ".env",
},
{
- "ignored": true,
+ "kind": "file",
+ "path": ".gitignore",
+ },
+ {
+ "kind": "file",
+ "path": ":(draft).md",
+ },
+ {
"kind": "directory",
+ "path": "empty",
+ },
+ {
+ "kind": "directory",
"path": "node_modules",
},
{
"kind": "directory",
"path": "src",
},
{
"kind": "directory",
- "path": "empty",
+ "path": "sub",
},
{
"kind": "file",
"path": "tracked.txt",
- },
- {
- "kind": "file",
- "path": ":(draft).md",
},
]
FAIL |t3| src/workspace/WorkspaceEntries.test.ts > WorkspaceEntries > list > labels the children of wide folders exactly as git does for each child
AssertionError: :foo: expected [ ':foo/pkg-0.js', …(1000) ] to deeply equal []
Test Files 1 failed (1)
Tests 2 failed | 33 passed (35)
# 4d1dab2 run 1
Test Files 1 passed (1)
Tests 35 passed (35)
# 4d1dab2 run 2
Test Files 1 passed (1)
Tests 35 passed (35)
# 4d1dab2 run 3
Test Files 1 passed (1)
Tests 35 passed (35)
# 4d1dab2 check:changed
check:changed summary
pass format 0.2s
pass lint 0.3s
pass knip 1/2 7.7s
pass knip 2/2 14.0s
pass graphql (apps/server) 0.4s
pass typecheck (3 packages) 8.8s
pass test (2 files) 9.8s
CI also runs: full test suites, build
unused patch check skipped: no dependency files changed
Not shown
- Windows and macOS (
:is not a legal Windows filename character, so the root-listing test adds:(draft).mdonly off Windows). - Desktop and mobile clients (both read the same server listing; no client code changed).
- Folders over 1,000 entries in the app (the wide-folder unit test covers their labels; it fails on
e3ff780and passes on4d1dab2).
An AI agent ran every check.
Generated with Gemini 4 Neon in T3 Code Nightly


Evidence#
Real web app, 1280×800, light theme, fresh isolated state on each commit. Seed an uncommitted repository with
.gitignorecontaining*.logand emptyignored.log,notes.md,README.md, and:(draft).md; open a Replay thread and choose Files in the right panel.The scenario fails on base and passes on head:
ignored.logrenders normally before the fix and greyed out afterward.Scenario source · Before recording · After recording
Not shown: