Skip to content

feat: add use_gitignore option to exclude ignored files from sources/generates#2773

Draft
vmaerten wants to merge 6 commits intomainfrom
git-ignore
Draft

feat: add use_gitignore option to exclude ignored files from sources/generates#2773
vmaerten wants to merge 6 commits intomainfrom
git-ignore

Conversation

@vmaerten
Copy link
Copy Markdown
Member

@vmaerten vmaerten commented Apr 4, 2026

Summary

Add gitignore: true option at the Taskfile (global) and task level to automatically exclude files matching .gitignore rules from sources and generates glob resolution

Uses lightweight sabhiram/go-gitignore library (zero transitive dependencies) instead of go-git

vmaerten added 2 commits April 3, 2026 22:35
…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.
@vmaerten vmaerten changed the title ✨ feat: add gitignore option to exclude ignored files from sources/generates feat: add gitignore option to exclude ignored files from sources/generates Apr 4, 2026
vmaerten added 2 commits April 4, 2026 10:29
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).
@vmaerten vmaerten changed the title feat: add gitignore option to exclude ignored files from sources/generates feat: add use_gitignore option to exclude ignored files from sources/generates Apr 4, 2026
vmaerten added 2 commits April 4, 2026 13:05
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.
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