Skip to content

fix(rg): preserve indexed explicit binary inputs - #1955

Merged
chaliy merged 1 commit into
mainfrom
2026-06-05-propose-fix-for-rg-input-handling-bug
Jun 5, 2026
Merged

chaliy merged 1 commit into
mainfrom
2026-06-05-propose-fix-for-rg-input-handling-bug

Conversation

@chaliy

@chaliy chaliy commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • try_indexed_search produced RgInput::discovered for all indexed matches even when the match corresponded to an explicit file operand, so the explicit-binary behavior (explicit files treated as binary by default) was not applied for indexed SearchCapable filesystems.

Description

  • When building indexed results in try_indexed_search, preserve the explicit-file classification by constructing RgInput::explicit when explicit_file_match is true instead of unconditionally using RgInput::discovered.
  • Add a regression test test_rg_indexed_explicit_binary_file_reports_match_by_default under the existing IndexedTestFs scaffolding to cover an explicit binary file returned via an indexed search.
  • Changes are localized to crates/bashkit/src/builtins/rg/mod.rs and do not alter recursive/discovered matching semantics.

Testing

  • Ran cargo fmt --check which succeeded.
  • Ran the targeted unit test cargo test -p bashkit --lib test_rg_indexed_explicit_binary_file_reports_match_by_default -- --nocapture which passed.

Codex Task

Copilot AI review requested due to automatic review settings June 5, 2026 19:49

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 fixes rg’s indexed-search input classification so that indexed matches corresponding to an explicit file operand are treated as explicit inputs, restoring the default “explicit files are binary by default” behavior for binary files on SearchCapable filesystems.

Changes:

  • In try_indexed_search, construct RgInput::explicit(...) (instead of always RgInput::discovered(...)) when an indexed match corresponds to an explicit file operand.
  • Add a regression test intended to cover explicit binary-file behavior when the filesystem provides indexed search results.

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

}],
});

let result = run_rg_with_fs(&["needle", "/proj/bin.dat"], None, fs).await;
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 5, 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 d3d2a02 Commit Preview URL Jun 05 2026, 08:24 PM

@chaliy
chaliy merged commit 618800a into main Jun 5, 2026
36 checks passed
@chaliy
chaliy deleted the 2026-06-05-propose-fix-for-rg-input-handling-bug branch June 5, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants