mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-04 23:09:44 +01:00
checkout: use os.path.samefile instead of stat
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
from stat import ST_INO, ST_DEV
|
||||
|
||||
from dvc.command.base import CmdBase, DvcLock
|
||||
from dvc.logger import Logger
|
||||
@@ -17,10 +16,7 @@ class CmdCheckout(CmdBase):
|
||||
if not os.path.isfile(data) or not os.path.isfile(cache):
|
||||
return False
|
||||
|
||||
data_st = os.stat(data)
|
||||
cache_st = os.stat(cache)
|
||||
|
||||
if (data_st[ST_INO], data_st[ST_DEV]) != (cache_st[ST_INO], cache_st[ST_DEV]):
|
||||
if not System.samefile(data, cache):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@@ -23,6 +23,13 @@ class System(object):
|
||||
|
||||
raise Exception('Not Implemented Yet')
|
||||
|
||||
@staticmethod
|
||||
def samefile(path1, path2):
|
||||
if System.is_unix():
|
||||
return os.path.samefile(path1, path2)
|
||||
|
||||
raise Exception('Not Implemented Yet')
|
||||
|
||||
@staticmethod
|
||||
def realpath(path):
|
||||
# It is definitely not the best way to check a symlink.
|
||||
|
||||
Reference in New Issue
Block a user