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
29 changes: 23 additions & 6 deletions crates/bashkit/src/builtins/rg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct RgOptions {
ignore_file_case_insensitive: bool,
unicode: bool,
messages: bool,
unrestricted_level: u8,
context_separator: String,
no_context_separator: bool,
field_match_separator: String,
Expand Down Expand Up @@ -159,12 +160,11 @@ struct RgTypeGlob {

impl RgOptions {
fn apply_unrestricted(&mut self) {
if !self.no_ignore {
self.no_ignore = true;
} else if !self.hidden {
self.hidden = true;
} else {
self.binary = true;
self.unrestricted_level = self.unrestricted_level.saturating_add(1);
match self.unrestricted_level {
1 => self.no_ignore = true,
2 => self.hidden = true,
_ => self.binary = true,
}
}

Expand Down Expand Up @@ -235,6 +235,7 @@ impl RgOptions {
ignore_file_case_insensitive: false,
unicode: true,
messages: true,
unrestricted_level: 0,
context_separator: "--".to_string(),
no_context_separator: false,
field_match_separator: ":".to_string(),
Expand Down Expand Up @@ -5577,6 +5578,22 @@ mod tests {
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "explicit no-ignore does not advance unrestricted level",
args: &["--no-ignore", "-u", "needle", "proj"],
stdin: None,
files: DIFF_UNRESTRICTED_FILES,
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "explicit hidden does not advance unrestricted level",
args: &["--hidden", "-uu", "needle", "proj"],
stdin: None,
files: DIFF_UNRESTRICTED_FILES,
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "long unrestricted is repeatable",
args: &["--unrestricted", "--unrestricted", "needle", "proj"],
Expand Down
Loading