Skip to content

feat: skip vcs directory trees during search#7

Merged
mroth merged 1 commit intomainfrom
skip-vcs-trees
Jul 27, 2025
Merged

feat: skip vcs directory trees during search#7
mroth merged 1 commit intomainfrom
skip-vcs-trees

Conversation

@mroth
Copy link
Copy Markdown
Owner

@mroth mroth commented Jul 27, 2025

This PR optimizes filesystem search performance by skipping version control system directories (.git, .hg, .svn, .jj) that typically contain many files but should never produce matches. It restructures the codebase to be more modular by separating search functionality from scanning, while simplifying the concurrency model.

Key changes:

  • Introduced a configurable Searcher component that can exclude VCS directories
  • Replaced the worker pool pattern with a semaphore-based approach for cleaner concurrency control
  • Added context support for cancellation throughout the scanning process

@mroth mroth requested a review from Copilot July 27, 2025 20:59
Copy link
Copy Markdown

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 optimizes filesystem search performance by skipping version control system directories (.git, .hg, .svn, .jj) that typically contain many files but never produce matches. It restructures the codebase to be more modular by separating search functionality from scanning, while simplifying the concurrency model.

Key changes:

  • Introduced a configurable Searcher component that can exclude VCS directories
  • Replaced the worker pool pattern with a semaphore-based approach for cleaner concurrency control
  • Added context support for cancellation throughout the scanning process

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
main.go Added context parameter to Scan function call
internal/deepclean/search.go New Searcher component with VCS directory exclusion logic
internal/deepclean/search_test.go Comprehensive tests for the new Searcher functionality
internal/deepclean/scan.go Refactored to use Searcher and simplified concurrency with semaphore
internal/deepclean/dirstats.go Extracted StatDir function with context cancellation support
internal/deepclean/dirstats_test.go Tests for StatDir including context cancellation
internal/deepclean/results.go Removed DirStats struct (moved to dirstats.go)
internal/deepclean/results_test.go Removed DirStats tests (moved to dirstats_test.go)
internal/deepclean/scan_test.go Updated test to include context parameter

Comment thread internal/deepclean/search_test.go Outdated
These can have lots of files and should never produce a match, so not
bothering to iterate them can make things more efficient.

This also restructures the bounded concurrency model a bit to be more
simple, while extracting the initial filesystem walk code to make
it more modular and configurable in the future.
@mroth mroth merged commit e225b34 into main Jul 27, 2025
5 checks passed
@mroth mroth deleted the skip-vcs-trees branch July 27, 2025 21:05
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