feat: add gitignore-scrub to catch tracked files newly matched by .gitignore #172
No Reviewers
Labels
Clear labels
Area/CI
Area/Completions
Area/Components
Area/Config
Area/Docs
Area/Functions
Area/Integrations
Area/Prompt & Theme
Area/Scripts
Area/Tests
Compat/Breaking
Kind/Bug
Kind/Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Refactor
Kind/Security
Kind/Testing
good first issue
help wanted
.github/workflows and repository automation
completions/ - tab-completion scripts
The opinionated-component system (C1-C6)
config.fish and conf.d/ - startup and environment
docs/manual/ and the generated manual, man page, and site
functions/ - user-facing functions and helpers
integrations/ - third-party tool wiring
themes/ and prompt appearance
scripts/ - standalone helper scripts
tests/ - the syntax lint and functional suite
Breaking change that won't be backward compatible
Something is not working
Tooling, dependencies, and housekeeping
Documentation changes
Improve existing functionality
New functionality
Makes existing behavior faster or lighter
Restructures code without changing behavior
This is security issue
Issue or pull request related to testing
Well-scoped and self-contained; a good place to start
Maintainer is looking for someone to pick this up
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rootiest/fish-config#172
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Adds
gitignore-scrub, a standalone function that finds files tracked by git but now matched by.gitignore, and offers to untrack them.git rm --cachedon confirmation. A decline is remembered per-path in the repo's local git config (gitignore-scrub.skip) so the same file isn't re-asked next time.-w/--warn: read-only — prints aWarning:line per match, makes no changes. Meant for non-interactive callers such as a personal git hook (declines from interactive runs still suppress the warning).-f/--force: skips the prompt, untracks every pending match immediately.-i/--individual: prompts once per file instead of once for the whole group.-r/--reset: clears the repo's skip list first, so previously declined files are reconsidered. Combines with any of the above.-w,-f, and-iare mutually exclusive (enforced viaargparse --exclusive).$GITIGNORE_SCRUB_LIMITtracked files (default 5000), to avoid adding latency to huge repos.ginow callsgitignore-scrubat the end of any run that touched.gitignore, so a newly-added pattern that matches an already-tracked file gets caught right where it happens.Also untracks
completions/fisher.fishandfunctions/fisher.fish— both matched an existing "Fisher-managed, do not commit".gitignorerule but were never scrubbed from the index since the initial commit. Found by runninggitignore-scrubfor real viagi fishin this repo.Why
.gitignorepatterns added after a file is already committed don't retroactively untrack it — the file just silently stays tracked. This makes that mismatch visible instead of relying on catching it by eye.Manual Verification Checklist
gi python(or any target) in a repo with a tracked file matching a newly-added pattern — confirm the prompt appears andgit rm --cachedruns onyn), then rungiagain — confirm the same file is not re-promptedgitignore-scrub --warnin a repo with an unconfirmed tracked-but-ignored file — confirm aWarning:line prints and no changes are madegitignore-scrub --force— confirm it untracks pending matches without promptinggitignore-scrub --individual— confirm each file gets its own promptgitignore-scrub --resetafter declining a file — confirm it's reconsideredgitignore-scrub -f -w— confirm it errors instead of silently picking onegitignore-scrub -h— confirm help text renderstests/run-tests.fishstill passes (786/786 locally)a9d14177b8to355688c134