Skip to content

fix(rg): handle multiline invert matches - #1665

Merged
chaliy merged 1 commit into
mainfrom
2026-05-22-rg-multiline-edges
May 22, 2026
Merged

chaliy merged 1 commit into
mainfrom
2026-05-22-rg-multiline-edges

Conversation

@chaliy

@chaliy chaliy commented May 22, 2026

Copy link
Copy Markdown
Contributor

What

Fix rg multiline invert matching and expand real-rg differential coverage for multiline edge modes.

Why

Real ripgrep treats lines spanned by a multiline match as matched for -v; Bashkit was falling back to per-line matching, so rg -v -U 'foo\nbar' printed every line.

How

  • Keep the multiline search path active for --invert-match.
  • Build the inverse line set from multiline match spans and use it for output, counts, file-list modes, context, quiet, and stats.
  • Add data-driven real-rg differential cases for multiline invert, invert count, files-without-match, column/byte offsets, vimgrep, JSON, and stdin.

Risk

  • Medium
  • Touches rg multiline output control flow. Covered by focused rg unit tests, expanded real-rg differential cases, and full pre-pr.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

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 cf7e1e7 Commit Preview URL May 22 2026, 08:31 AM

@chaliy
chaliy merged commit e9b154b into main May 22, 2026
34 checks passed
@chaliy
chaliy deleted the 2026-05-22-rg-multiline-edges branch May 22, 2026 08:44
chaliy added a commit that referenced this pull request May 30, 2026
## What
Fix rg multiline invert matching and expand real-rg differential
coverage for multiline edge modes.

## Why
Real ripgrep treats lines spanned by a multiline match as matched for
`-v`; Bashkit was falling back to per-line matching, so `rg -v -U
'foo\nbar'` printed every line.

## How
- Keep the multiline search path active for `--invert-match`.
- Build the inverse line set from multiline match spans and use it for
output, counts, file-list modes, context, quiet, and stats.
- Add data-driven real-rg differential cases for multiline invert,
invert count, files-without-match, column/byte offsets, vimgrep, JSON,
and stdin.

## Risk
- Medium
- Touches rg multiline output control flow. Covered by focused rg unit
tests, expanded real-rg differential cases, and full pre-pr.

## Checklist
- [x] Tests added or updated
- [x] Backward compatibility considered
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.

1 participant