diff --git a/dvc/remote/ssh/connection.py b/dvc/remote/ssh/connection.py index 16f74c2d5..039652e61 100644 --- a/dvc/remote/ssh/connection.py +++ b/dvc/remote/ssh/connection.py @@ -60,13 +60,13 @@ class SSHConnection: def st_mode(self, path): with ignore_file_not_found(): - return self.sftp.stat(path).st_mode + return self.sftp.lstat(path).st_mode return 0 def getsize(self, path): with ignore_file_not_found(): - return self.sftp.stat(path).st_size + return self.sftp.lstat(path).st_size return 0 diff --git a/tests/unit/remote/ssh/test_connection.py b/tests/unit/remote/ssh/test_connection.py index ae79d4d92..cadba03f2 100644 --- a/tests/unit/remote/ssh/test_connection.py +++ b/tests/unit/remote/ssh/test_connection.py @@ -81,7 +81,9 @@ def test_walk(tmp_path, ssh): reason="Only works on OSX (because of APFS)") def test_reflink(chdir_tmp, foo, ssh): ssh.reflink("foo", "bar") - assert System.is_reflink(bar_path) + assert filecmp.cmp("foo", "bar") + assert not System.is_symlink("bar") + assert not System.is_hardlink("bar") @pytest.mark.skip(reason="MockSSH doesn't support symlinks") def test_symlink(chdir_tmp, foo, ssh):