Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gix-fs/tests/dir/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ mod empty_upwards_until_boundary {
let dir = tempfile::tempdir()?;
let target = dir.path().join("actually-a-file");
std::fs::write(&target, [42])?;
assert!(remove::empty_upward_until_boundary(&target, dir.path()).is_err()); // TODO: check for IsNotADirectory when it becomes stable

let res = remove::empty_upward_until_boundary(&target, dir.path());
assert!(res.is_err());
assert!(res.err().unwrap().kind() == io::ErrorKind::NotADirectory);
assert!(target.is_file(), "it didn't touch the file");
assert!(dir.path().is_dir(), "it won't touch the boundary");
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion gix-glob/src/search/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn io_err_is_dir(err: &std::io::Error) -> bool {
let raw = err.raw_os_error();
raw == Some(if cfg!(windows) { 5 } else { 21 }) /* Not a directory */
/* Also that, but under different circumstances */
|| raw == Some(20)
|| raw == Some(20) || err.kind() == std::io::ErrorKind::NotADirectory
}

/// Instantiation
Expand Down
2 changes: 1 addition & 1 deletion gix-odb/src/store_impls/dynamic/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Store {
)?;
if !objects_dir.is_dir() {
return Err(std::io::Error::new(
std::io::ErrorKind::Other, // TODO: use NotADirectory when stabilized
std::io::ErrorKind::NotADirectory,
format!("'{}' wasn't a directory", objects_dir.display()),
));
}
Expand Down
Loading