1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-04-08 16:53:58 +02:00

Always search paths given by user.

This permits doing `rg -a test /dev/sda1` for example, where as before
/dev/sda1 was skipped because it wasn't a regular file.
This commit is contained in:
Andrew Gallant 2016-11-06 18:23:50 -05:00
parent 9cab076a72
commit 9fc9f368f5

View File

@ -271,10 +271,19 @@ fn get_or_log_dir_entry(
eprintln!("{}", err);
}
}
if !dent.file_type().map_or(true, |x| x.is_file()) {
None
} else {
// 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() {
None => return Some(dent), // entry is stdin
Some(ft) => ft,
};
if ft.is_file() {
Some(dent)
} else {
None
}
}
}