Skip to content

Commit

Permalink
ignore: fix failing test
Browse files Browse the repository at this point in the history
This fixes fallout from fixing #1520.
  • Loading branch information
BurntSushi committed Mar 16, 2020
1 parent 34edb81 commit 8ba6ccd
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions crates/ignore/src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1170,29 +1170,16 @@ 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"));
assert!(err.is_none());

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());
}
}

0 comments on commit 8ba6ccd

Please sign in to comment.