Skip to content

fix(rg): positive globs and type includes unhide hidden files but not hidden directories#2061

Merged
chaliy merged 2 commits into
mainfrom
fix/pr-2049-rg-hidden-files
Jun 12, 2026
Merged

fix(rg): positive globs and type includes unhide hidden files but not hidden directories#2061
chaliy merged 2 commits into
mainfrom
fix/pr-2049-rg-hidden-files

Conversation

@chaliy

@chaliy chaliy commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Closes #2049

A positive --glob pattern or --type include that explicitly names a hidden file should let that file be visited even without --hidden, matching ripgrep's behaviour. Hidden directories remain excluded unless --hidden is set.

Copilot AI review requested due to automatic review settings June 12, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown

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 adjusts rg file discovery/filtering so that hidden files can be searched when they match a positive --glob include or --type include, even without --hidden, while hidden directories remain excluded unless --hidden is set—aligning behavior with ripgrep.

Changes:

  • Add helper methods on RgOptions to detect whether a hidden file is explicitly allowed by positive glob/type includes.
  • Update recursive filesystem walk to skip hidden directories but conditionally allow hidden files when explicitly included.
  • Update indexed-search hidden filtering logic and add regression tests for recursive and indexed modes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/bashkit/src/builtins/rg/mod.rs Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 43bb33a Commit Preview URL

Branch Preview URL
Jun 12 2026, 10:14 AM

Replace Vec component collection with a Peekable iterator. Uses
peek().is_none() to detect whether a hidden component is the final
segment (file, may be allowed) vs intermediate (directory, excluded).
@chaliy chaliy merged commit d3e6363 into main Jun 12, 2026
36 checks passed
@chaliy chaliy deleted the fix/pr-2049-rg-hidden-files branch June 12, 2026 10:35
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