From 468f4beee790adab8f93f6d0f8cfddde09f57511 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 5 Jul 2018 19:59:37 +0300 Subject: [PATCH] dvc: properly save symlinks Signed-off-by: Ruslan Kuprieiev --- dvc/system.py | 2 +- dvc/utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dvc/system.py b/dvc/system.py index 09c1b285e..666731f6b 100644 --- a/dvc/system.py +++ b/dvc/system.py @@ -61,7 +61,7 @@ class System(object): @staticmethod def inode(path): if System.is_unix(): - return os.stat(path).st_ino + return os.lstat(path).st_ino # getdirinfo from ntfsutils works on both files and dirs info = System.getdirinfo(path) diff --git a/dvc/utils.py b/dvc/utils.py index 509cd101c..25c98198d 100644 --- a/dvc/utils.py +++ b/dvc/utils.py @@ -99,6 +99,11 @@ def move(src, dst): if not os.path.exists(dname): os.makedirs(dname) + if os.path.islink(src): + shutil.copy(os.readlink(src), dst) + os.unlink(src) + return + shutil.move(src, dst)