mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07: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:
parent
9cab076a72
commit
9fc9f368f5
15
src/main.rs
15
src/main.rs
@ -271,10 +271,19 @@ fn get_or_log_dir_entry(
|
|||||||
eprintln!("{}", err);
|
eprintln!("{}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !dent.file_type().map_or(true, |x| x.is_file()) {
|
// A depth of 0 means the user gave the path explicitly, so we
|
||||||
None
|
// should always try to search it.
|
||||||
} else {
|
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)
|
Some(dent)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user