summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2020-03-16 19:16:24 -0400
committerAndrew Gallant <jamslam@gmail.com>2020-03-16 19:16:24 -0400
commit8ba6ccd159ba6bee6ad869a2a09565f3625febb7 (patch)
tree0495735b49e25ac0845c0a33bd9b0016222bc7eb
parent34edb8123a0b7bd69a61cd237fec8c1b26a3f786 (diff)
ignore: fix failing test
This fixes fallout from fixing #1520.
-rw-r--r--crates/ignore/src/dir.rs23
1 files changed, 5 insertions, 18 deletions
diff --git a/crates/ignore/src/dir.rs b/crates/ignore/src/dir.rs
index fbce80d5..296c8034 100644
--- a/crates/ignore/src/dir.rs
+++ b/crates/ignore/src/dir.rs
@@ -837,7 +837,7 @@ fn resolve_git_commondir(
#[cfg(test)]
mod tests {
use std::fs::{self, File};
- use std::io::{self, Write};
+ use std::io::Write;
use std::path::Path;
use dir::IgnoreBuilder;
@@ -1170,22 +1170,9 @@ mod tests {
// missing commondir file
assert!(fs::remove_file(commondir_path()).is_ok());
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
- assert!(err.is_some());
- assert!(match err {
- Some(Error::WithPath { path, err }) => {
- if path != commondir_path() {
- false
- } else {
- match *err {
- Error::Io(ioerr) => {
- ioerr.kind() == io::ErrorKind::NotFound
- }
- _ => false,
- }
- }
- }
- _ => false,
- });
+ // We squash the error in this case, because it occurs in repositories
+ // that are not linked worktrees but have submodules.
+ assert!(err.is_none());
wfile(td.path().join("linked-worktree/.git"), "garbage");
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
@@ -1193,6 +1180,6 @@ mod tests {
wfile(td.path().join("linked-worktree/.git"), "gitdir: garbage");
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
- assert!(err.is_some());
+ assert!(err.is_none());
}
}