-
Notifications
You must be signed in to change notification settings - Fork 1
Respect the user's global gitignore file #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
File reading operations should be able to include git-ignored files when explicitly specified. Global gitignore patterns belong in the analysis phase, not the file reading phase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The collectDirectories function was missing global gitignore support that should be applied during analysis phase. This ensures the user's global gitignore file is respected when collecting directories to analyze. Also adds test coverage for globally gitignored directories using a real filesystem with a temporary HOME directory. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables whatsun to respect patterns defined in the user's global gitignore file when analyzing repositories. The implementation adds global gitignore support to both file tree generation and repository analysis operations.
- Added global gitignore detection logic that checks ~/.gitignore first, then falls back to git config core.excludesFile
- Integrated global gitignore patterns into file tree generation and directory analysis workflows
- Added comprehensive test coverage for global gitignore functionality across different scenarios
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/fsgitignore/gitignore.go |
Core implementation of global gitignore detection and pattern parsing |
internal/fsgitignore/gitignore_test.go |
Comprehensive tests for global gitignore functionality |
pkg/files/tree.go |
Integration of global gitignore patterns into file tree generation |
pkg/rules/analyze.go |
Integration of global gitignore patterns into repository analysis |
pkg/rules/analyze_osfs_test.go |
Test verifying global gitignore works with real filesystem operations |
pkg/rules/analyze_testfs_test.go |
Minor whitespace addition |
By Claude:
This change enables whatsun to respect patterns in the user's global gitignore file when analyzing repositories and generating file trees.
Changes
whatsun digestandwhatsun analyze)Behavior
When analyzing a repository, whatsun will now automatically exclude files matching patterns from:
This improves the user experience by honoring their personal ignore preferences across all repositories, making the output more relevant and focused.