From 1f23f3f0ccfcccff3226b1d06a48205624297d83 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Thu, 28 Sep 2017 17:46:30 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20ignore=20.gitignore=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fs/feature/ignore.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fs/feature/ignore.rs b/src/fs/feature/ignore.rs index 10c0d94..cabf86c 100644 --- a/src/fs/feature/ignore.rs +++ b/src/fs/feature/ignore.rs @@ -24,7 +24,6 @@ impl IgnoreCache { IgnoreCache::default() } - #[allow(unused_results)] // don’t do this pub fn discover_underneath(&self, path: &Path) { let mut path = Some(path); let mut entries = self.entries.write().unwrap(); @@ -37,10 +36,14 @@ impl IgnoreCache { debug!("Found a .gitignore file: {:?}", ignore_file); if let Ok(mut file) = File::open(ignore_file) { let mut contents = String::new(); - file.read_to_string(&mut contents).expect("Reading gitignore failed"); - let (patterns, mut _errors) = IgnorePatterns::parse_from_iter(contents.lines()); - entries.push((p.into(), patterns)); + match file.read_to_string(&mut contents) { + Ok(_) => { + let (patterns, mut _errors) = IgnorePatterns::parse_from_iter(contents.lines()); + entries.push((p.into(), patterns)); + } + Err(e) => debug!("Failed to read a .gitignore: {:?}", e) + } } } else {