Skip to content

Leave folders that git ignores out of the workspace - #1485

Merged
davidanthoff merged 1 commit into
mainfrom
fix/c54-gitignored-folders
Oct 3, 2026
Merged

davidanthoff merged 1 commit into
mainfrom
fix/c54-gitignored-folders

Conversation

@davidanthoff

Copy link
Copy Markdown
Member

Opened by Claude (Claude Code) from a crash-telemetry review (c54).

Depends on JuliaWorkspaces.jl#353. This PR raises the compat bound to JuliaWorkspaces = "13.5" with no runtime feature check, so CI stays red until JuliaWorkspaces 13.5 is registered.

Why

A 1.243.1 crash report's stderr showed a background indexing child starting again and again for deps/build/_CPack_Packages/win64/ZIP/iGMT-0.1.0-win64/full. That folder is CPack's staging copy of the user's package, including its Project.toml, so it was indexed as a second package. Every cpack run re-creates it. The ** create/delete watcher then removed and re-added its Project.toml, and each re-add served the scratch environment again and started another refresh child. The folder is gitignored (deps/build/). JuliaWorkspaces.jl#353 has the full analysis and the reproduction.

Change

  • One rule set for the whole workspace. gitignore_filter(server) is a JuliaWorkspaces.GitIgnoreFilter for the current workspace folders. It is built on first use and reset when a workspace folder is added or removed, or when a .gitignore changes.
    • collect_folder_files! passes it to the walk, so the initial load, folder-create scans (add_folder_children!) and workspace-folder adds all skip ignored folders.
    • A folder created inside an ignored folder is walked under the workspace folder's rules, so nothing in it is picked up.
  • Watcher events. A Created/Changed event for a file in an ignored folder is dropped before anything is read, unless the file is open or already tracked. A CPack re-stage of hundreds of files under deps/build therefore costs no reads and adds nothing.
  • .gitignore edits take effect live. **/.gitignore joins the registered watchers. An event for one runs rescan_workspace_folders!: it re-walks each workspace folder under the new rules (paths only), drops tracked files that are no longer admitted, and reads and adds only the newly admitted ones, in one add_files! batch. Open files stay in the workspace either way.
  • Only folders are skipped, never single files, so a gitignored Manifest.toml still counts.
  • Files the user opens in the editor are analysed as before.

Tests

Two new items in test/test_watched_folders.jl:

  • In a git repository with deps/build/ ignored, a folder create plus file Created/Changed events for a CPack-style copy add nothing, while a new src/b.jl is added.
  • Adding gen/ to .gitignore and sending its event removes the tracked gen files and keeps the open one. Removing the rule brings them back, and the open file gets its from-disc record back.

Full suite run locally on Windows with Julia 1.12, against JuliaWorkspaces.jl#353: 213152 passed and 1 broken (pre-existing), no failures.

🤖 Generated with Claude Code

Build output that git ignores (`deps/build/`, `docs/build/`, coverage trees)
is no longer part of the workspace. The initial walk, folder-create scans and
workspace-folder adds all go through one `GitIgnoreFilter` built from the
workspace folders, and Created/Changed watcher events for files in an ignored
folder are dropped before anything is read. This is what stops a CPack
re-stage of `deps/build/_CPack_Packages/.../full`, a copy of the package,
from becoming a second package and starting an indexing child on every
`cpack` run.

A `.gitignore` edit takes effect right away: `**/.gitignore` is watched, and
an event for one re-scans the workspace folders, dropping the tracked files
the new rules hide and adding the ones they now admit. Files open in the
editor stay either way.

Needs JuliaWorkspaces 13.5 for `GitIgnoreFilter`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidanthoff
davidanthoff merged commit 9a714dd into main Oct 3, 2026
34 of 54 checks passed
@davidanthoff
davidanthoff deleted the fix/c54-gitignored-folders branch October 3, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant