mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 07:18:28 +01:00
stage: save: remove link from cache if cache already exists
Fixes #447 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+5
-1
@@ -285,7 +285,11 @@ class Output(Dependency):
|
||||
cache = self.project.cache.get(md5)
|
||||
cache_info = os.path.join(self.cache, relpath)
|
||||
|
||||
self.hardlink(path, cache)
|
||||
if os.path.exists(cache):
|
||||
self._remove(path, None)
|
||||
self.hardlink(cache, path)
|
||||
else:
|
||||
self.hardlink(path, cache)
|
||||
|
||||
os.makedirs(os.path.dirname(cache_info))
|
||||
with open(cache_info, 'w') as fd:
|
||||
|
||||
Reference in New Issue
Block a user