data: set read-only flag

Fixes #278
Fixes #277
Fixes #276

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-11-01 04:04:25 +02:00
parent fad091e9a6
commit 2be87f57fd
+4 -3
View File
@@ -1,4 +1,5 @@
import os
import stat
import shutil
from dvc.path.path import Path
@@ -104,6 +105,6 @@ class DataItem(object):
md5 = file_md5(self.data.relative)[0]
self._cache_file = os.path.join(self.cache_dir, md5)
self._git.modify_gitignore([self.data.relative])
if os.path.isfile(self.cache.relative):
return
System.hardlink(self.data.relative, self.cache.relative)
if not os.path.isfile(self.cache.relative):
System.hardlink(self.data.relative, self.cache.relative)
os.chmod(self.data.relative, stat.S_IREAD)