mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
Merge branch 'gitignore_blank_lines'
This commit is contained in:
commit
ebabe1df6a
@ -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(),
|
||||||
@ -426,4 +429,10 @@ mod tests {
|
|||||||
not_ignored!(ignot11, ROOT, "#foo", "#foo");
|
not_ignored!(ignot11, ROOT, "#foo", "#foo");
|
||||||
not_ignored!(ignot12, ROOT, "\n\n\n", "foo");
|
not_ignored!(ignot12, ROOT, "\n\n\n", "foo");
|
||||||
not_ignored!(ignot13, ROOT, "foo/**", "foo", true);
|
not_ignored!(ignot13, ROOT, "foo/**", "foo", true);
|
||||||
|
|
||||||
|
// See: https://github.com/BurntSushi/ripgrep/issues/106
|
||||||
|
#[test]
|
||||||
|
fn regression_106() {
|
||||||
|
Gitignore::from_str("/", " ").unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user