Skip to content

fix(rg): count unrestricted flags independently#1754

Merged
chaliy merged 1 commit into
mainfrom
2026-05-25-fix-rg-u-parsing-compatibility-bug
May 25, 2026
Merged

fix(rg): count unrestricted flags independently#1754
chaliy merged 1 commit into
mainfrom
2026-05-25-fix-rg-u-parsing-compatibility-bug

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 25, 2026

Motivation

  • Fix correctness regression where -u/--unrestricted advanced behavior by inspecting current no_ignore/hidden booleans, causing explicit --no-ignore/--hidden flags to incorrectly consume unrestricted levels and producing order-dependent semantics.

Description

  • Add a new unrestricted_level: u8 field to RgOptions and initialize it in RgOptions::parse so unrestricted usage is tracked independently of explicit flags.
  • Replace apply_unrestricted() logic to increment unrestricted_level and map levels 1 => no_ignore, 2 => hidden, >=3 => binary to match ripgrep semantics regardless of flag order.
  • Add two regression differential tests to rg test cases to cover --no-ignore -u and --hidden -uu so explicit flags do not advance unrestricted levels.
  • Commit message: fix(rg): count unrestricted flags independently.

Testing

  • Ran the focused test with cargo test -p bashkit rg::tests::rg_real_diff_unrestricted -- --nocapture, and the test completed successfully.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 25, 2026

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 b8a67bf Commit Preview URL May 25 2026, 02:42 AM

@chaliy chaliy merged commit c90ab14 into main May 25, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-25-fix-rg-u-parsing-compatibility-bug branch May 25, 2026 15:09
chaliy added a commit that referenced this pull request May 25, 2026
When -u/--unrestricted is first applied (level 1) it now disables all
per-class ignore toggles (no_ignore_dot, no_ignore_exclude,
no_ignore_global, no_ignore_parent, no_ignore_vcs) in addition to
no_ignore, matching real ripgrep behavior. This way later positive
flags such as --ignore-dot can re-enable only their intended class.

Adds a differential regression case '-u --ignore-dot'.

Rebased on current main on top of #1754; original PR #1751 by chaliy.
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.

1 participant