feat: add use_gitignore option to exclude ignored files from sources/generates#2773
Draft
feat: add use_gitignore option to exclude ignored files from sources/generates#2773
Conversation
…rates When `gitignore: true` is set at the Taskfile or task level, files matching .gitignore rules are automatically excluded from sources and generates glob resolution. This prevents rebuilds triggered by changes to files that are in .gitignore (build artifacts, generated files, etc.). Uses go-git to load .gitignore patterns including nested .gitignore files, .git/info/exclude, and global gitignore configuration.
…dency go-git pulled ~30 transitive dependencies and recursively walked the entire worktree on every Globs() call. Replace with sabhiram/go-gitignore (zero dependencies) and a simple walk from task dir up to rootDir to collect .gitignore files. Pass rootDir (Taskfile ROOT_DIR) through the checker chain to bound the search scope.
Walk up from task dir to find .git instead of threading rootDir through Globs, checkers, and itemsFromFor. Gitignore rules are discarded if no .git is found, matching ripgrep's require_git behavior. This keeps the Globs signature clean and makes the future .taskignore integration straightforward (loaded at setup like .taskrc, separate boundary).
Rename the Taskfile/task option from `gitignore` to `use_gitignore` to avoid ambiguity (could be read as "ignore git" vs "use .gitignore"). Consistent with Biome's `useIgnoreFile` naming convention.
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.
Summary
Add
gitignore: trueoption at the Taskfile (global) and task level to automatically exclude files matching.gitignorerules fromsourcesandgeneratesglob resolutionUses lightweight
sabhiram/go-gitignorelibrary (zero transitive dependencies) instead ofgo-git