mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
fsinfo: autocorrect "" to "."
Summary: Without this: In [3]: util.getfstype('') IOError: [Errno 2] No such file or directory (os error 2) And there is a code path hitting this: File "edenscm/mercurial/util.py", line 1483, in checknlink fstype = getfstype(os.path.dirname(testfile)) # testfile = '.' # os.path.dirname(".") = "" The old implementation works fine for an empty path: In [2]: m.util.getfstype('') Out[2]: 'eden' So let's make the new Rust implementation consistent. Reviewed By: xavierd Differential Revision: D20313387 fbshipit-source-id: 258c424a3e8a796d983e20b0d4656e8e3f413706
This commit is contained in:
parent
ea59a506f1
commit
c5c75c9f59
@ -222,6 +222,13 @@ mod macos {
|
||||
pub fn fstype(path: impl AsRef<Path>) -> io::Result<String> {
|
||||
let path = path.as_ref();
|
||||
|
||||
// Auto correct an empty path to ".".
|
||||
let path = if path == Path::new("") {
|
||||
Path::new(".")
|
||||
} else {
|
||||
path
|
||||
};
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
return self::linux::fstype(path);
|
||||
|
Loading…
Reference in New Issue
Block a user