Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): file listing keeps gitignore status when a filename looks like a git pathspec #42333

Mergedonly21mil(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/42333/headmerged by juliusmarminge View on GitHub

Problem

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".

e3ff7804d1dab2
ignored.log looks like a normal file next to :(draft).md
ignored.log looks like a normal file next to :(draft).md
ignored.log is greyed out as gitignored 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).md only 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 e3ff780 and passes on 4d1dab2).

An AI agent ran every check.

Generated with Gemini 4 Neon in T3 Code Nightly

    1. Pushed4d0a888

    2. Evidence

      Real web app, 1280×800, light theme, fresh isolated state on each commit. Seed an uncommitted repository with .gitignore containing *.log and empty ignored.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.log renders normally before the fix and greyed out afterward.

      BeforeAfter
      Before: ignored.log loses ignored stylingAfter: ignored.log retains ignored styling
      ece5f21b174d0a888a26

      Scenario source · Before recording · After recording

      Not shown:

      • Ignored colon-prefixed directories and the wide-folder shortcut were not exercised; this scenario covers the reported filename batch failure.
      • The rename-and-refresh control was not exercised; both commits were compared with the pathspec-like filename present.
    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged this8a5dbb4

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.