mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-01 20:52:03 -07:00
Don't ever search directories.
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -271,16 +271,15 @@ fn get_or_log_dir_entry(
|
|||||||
eprintln!("{}", err);
|
eprintln!("{}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A depth of 0 means the user gave the path explicitly, so we
|
|
||||||
// should always try to search it.
|
|
||||||
if dent.depth() == 0 {
|
|
||||||
return Some(dent);
|
|
||||||
}
|
|
||||||
let ft = match dent.file_type() {
|
let ft = match dent.file_type() {
|
||||||
None => return Some(dent), // entry is stdin
|
None => return Some(dent), // entry is stdin
|
||||||
Some(ft) => ft,
|
Some(ft) => ft,
|
||||||
};
|
};
|
||||||
if ft.is_file() {
|
// A depth of 0 means the user gave the path explicitly, so we
|
||||||
|
// should always try to search it.
|
||||||
|
if dent.depth() == 0 && !ft.is_dir() {
|
||||||
|
Some(dent)
|
||||||
|
} else if ft.is_file() {
|
||||||
Some(dent)
|
Some(dent)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
Reference in New Issue
Block a user