mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-04-19 09:02:15 +02:00
Allow (and ignore) whitespace-only lines in .gitignore files
Git considers these to be blank lines.
This commit is contained in:
parent
104d740f76
commit
20ccd441f2
@ -283,12 +283,15 @@ impl GitignoreBuilder {
|
|||||||
from: P,
|
from: P,
|
||||||
mut line: &str,
|
mut line: &str,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
if line.is_empty() || line.starts_with("#") {
|
if line.starts_with("#") {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if !line.ends_with("\\ ") {
|
if !line.ends_with("\\ ") {
|
||||||
line = line.trim_right();
|
line = line.trim_right();
|
||||||
}
|
}
|
||||||
|
if line.is_empty() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let mut pat = Pattern {
|
let mut pat = Pattern {
|
||||||
from: from.as_ref().to_path_buf(),
|
from: from.as_ref().to_path_buf(),
|
||||||
original: line.to_string(),
|
original: line.to_string(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user