mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-04 18:18:17 +00:00
Fix glob pattern to correctly ignore directories with only dots
This commit is contained in:
parent
de4baa1002
commit
aadcd1a0c7
1 changed files with 1 additions and 1 deletions
|
@ -7,7 +7,7 @@ use bstr::{ByteSlice, ByteVec};
|
|||
/// If the path terminates in `.`, `..`, or consists solely of a root of
|
||||
/// prefix, file_name will return None.
|
||||
pub(crate) fn file_name<'a>(path: &Cow<'a, [u8]>) -> Option<Cow<'a, [u8]>> {
|
||||
if path.last_byte().map_or(true, |b| b == b'.') {
|
||||
if path.iter().all(|&b| b == b'.') {
|
||||
return None;
|
||||
}
|
||||
let last_slash = path.rfind_byte(b'/').map(|i| i + 1).unwrap_or(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue