diff options
author | Tom Jackson <tjackson@fb.com> | 2016-09-26 09:34:32 -0700 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-26 18:52:57 -0400 |
commit | 20ccd441f2d6000100bbbbade37aeca492d55ee0 (patch) | |
tree | fdf70a6757b6a6b1a2f6b629a50c2882cf7b6172 | |
parent | 104d740f769256ee6beeaef5a0d1c245947c0ce9 (diff) |
Allow (and ignore) whitespace-only lines in .gitignore files
Git considers these to be blank lines.
-rw-r--r-- | src/gitignore.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gitignore.rs b/src/gitignore.rs index e05dc582..c4f46fa0 100644 --- a/src/gitignore.rs +++ b/src/gitignore.rs @@ -283,12 +283,15 @@ impl GitignoreBuilder { from: P, mut line: &str, ) -> Result<(), Error> { - if line.is_empty() || line.starts_with("#") { + if line.starts_with("#") { return Ok(()); } if !line.ends_with("\\ ") { line = line.trim_right(); } + if line.is_empty() { + return Ok(()); + } let mut pat = Pattern { from: from.as_ref().to_path_buf(), original: line.to_string(), |