Filter worktree file copying through a supaignore file - #806
Merged
sbertix merged 4 commits intoAug 19, 2026
Conversation
Gitignore-syntax merge of the three supaignore layers (least to most specific, committed wins last), a validated resolution whose resolved case carries an EffectiveSupaignorePatterns so an empty filter is unrepresentable, a copy plan that prunes .git and nested-repo entries and dedupes across both categories by construction, and a best-effort copier that preserves symlinks, refuses a symlinked ancestor, never clobbers, and surfaces an unreadable source as a failure.
Read the three layers (global, repo-default, committed via git) and merge them, failing safe to .failed on any read error so the copy never falls back to wt's unfiltered path. Gate the committed lookup on the object being a blob and read it through a new byte-preserving ShellClient path so a pattern's edge whitespace survives (a non-UTF-8 blob fails safe). Plan the surviving ignored / untracked files with a supaignore-only matcher isolated from the repo's own .gitignore.
When a filter resolves, wt creates the worktree with both copy flags off and Supacode copies the surviving files itself; when absent, delegate to wt unchanged. A resolution or plan failure copies nothing (never the unfiltered wt copy) and a copy failure surfaces a non-fatal advisory, coalesced with the upstream-tracking advisory, never a failed creation.
Add a footer stating the copy applies to local repositories only, and disable the copy pickers with an explanation for remote repositories.
sbertix
enabled auto-merge (squash)
August 19, 2026 20:13
sbertix
deleted the
sbertix/gh-267-granular-selection-to-copy-ignored-untra
branch
August 19, 2026 20:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #267
Summary
New worktrees can now copy only the ignored/untracked files you actually want, filtered by a
supaignorefile (gitignore syntax) instead of the previous all-or-nothing copy. Three layers merge, least to most specific (committed wins last): a global~/.config/supacode/supaignore, the repo's default-worktree-directorysupaignore, and a per-reposupaignorecommitted to the base ref (read from the object store, so it resolves before checkout). Patterns subtractively filter the existing copy-ignored / copy-untracked sets using git's own matching, isolated from the repo's.gitignore.The copy is local-only and fail-safe: if any layer can't be resolved, nothing is copied (never a silent fallback to the unfiltered copy), surfaced as a non-fatal advisory. The settings note the local-only scope.
Type of change
ready)How was this tested?
make checkpasses (format + lint)make testpassesReal-git integration tests (temp repos) cover the layered merge and precedence, gitignore isolation, negation, nested-repo pruning, the blob-only committed read, byte-preserving whitespace, and fail-safe on every read error; reducer tests cover the create-worktree wiring and coalesced advisories; unit tests cover the merge / plan / copier primitives.
Checklist
Closes #above.ready.