mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-04 07:18:27 +01:00
system: ensure inode value is correct
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+10
-7
@@ -178,10 +178,13 @@ class System(object):
|
||||
@staticmethod
|
||||
def inode(path):
|
||||
if System.is_unix():
|
||||
return os.lstat(path).st_ino
|
||||
|
||||
# getdirinfo from ntfsutils works on both files and dirs
|
||||
info = System.getdirinfo(path)
|
||||
return hash((info.dwVolumeSerialNumber,
|
||||
info.nFileIndexHigh,
|
||||
info.nFileIndexLow))
|
||||
inode = os.lstat(path).st_ino
|
||||
else:
|
||||
# getdirinfo from ntfsutils works on both files and dirs
|
||||
info = System.getdirinfo(path)
|
||||
inode = abs(hash((info.dwVolumeSerialNumber,
|
||||
info.nFileIndexHigh,
|
||||
info.nFileIndexLow)))
|
||||
assert inode >= 0
|
||||
assert inode < 2**64
|
||||
return inode
|
||||
|
||||
Reference in New Issue
Block a user