Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions crates/bashkit/src/builtins/rg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,7 @@ async fn try_indexed_search(
) -> Option<Vec<(String, String)>> {
if opts.invert_match
|| opts.files_without_matches
|| opts.crlf
|| opts.uses_ignore_files()
|| opts.patterns.len() != 1
|| opts.max_filesize.is_some()
Expand Down Expand Up @@ -7536,6 +7537,25 @@ mod tests {
assert_eq!(result.stdout, "");
}

#[tokio::test]
async fn test_rg_crlf_skips_indexed_prefilter_and_falls_back_to_linear_scan() {
let inner = InMemoryFs::new();
inner.mkdir(Path::new("/safe"), true).await.unwrap();
inner
.write_file(Path::new("/safe/crlf.txt"), b"needle\r\nother\r\n")
.await
.unwrap();

let fs = Arc::new(IndexedTestFs {
inner,
matches: Vec::new(),
});

let result = run_rg_with_fs(&["--crlf", "needle$", "/safe/crlf.txt"], None, fs).await;
assert_eq!(result.exit_code, 0);
assert_eq!(result.stdout, "needle\r\n");
}

#[test]
fn real_rg_binary_is_available_for_differential_tests() {
require_real_rg();
Expand Down
Loading