这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@pjcdawkins
Copy link
Contributor

@pjcdawkins pjcdawkins commented Aug 16, 2025

By Claude:

This change enables whatsun to respect patterns in the user's global gitignore file when analyzing repositories and generating file trees.

Changes

  • Detection logic: First checks for ~/.gitignore, then falls back to git config --global core.excludesFile
  • Integration: Applied to both file tree generation (whatsun tree) and analysis operations (whatsun digest and whatsun analyze)
  • Error handling: Gracefully handles missing files and configuration without breaking functionality
  • Testing: Added comprehensive tests for various global gitignore scenarios

Behavior

When analyzing a repository, whatsun will now automatically exclude files matching patterns from:

  1. Local .gitignore files (existing behavior)
  2. .git/info/exclude files (existing behavior)
  3. User's global gitignore file (new)

This improves the user experience by honoring their personal ignore preferences across all repositories, making the output more relevant and focused.

@pjcdawkins pjcdawkins requested a review from Copilot August 16, 2025 14:37

This comment was marked as outdated.

pjcdawkins and others added 2 commits August 16, 2025 21:01
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>
@pjcdawkins pjcdawkins requested a review from Copilot August 17, 2025 01:12
Copy link

Copilot AI left a 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

@pjcdawkins pjcdawkins merged commit ab413b8 into main Aug 21, 2025
2 checks passed
@pjcdawkins pjcdawkins deleted the read-global-gitignore branch August 21, 2025 03:19
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.

2 participants