From 459b21e0cfe94fee3ebc50aa064234f22ba3b38a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 1 Jul 2018 22:31:35 +0300 Subject: [PATCH] output: local: don't add/remove to/from gitignore if file is external Signed-off-by: Ruslan Kuprieiev --- dvc/output/local.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dvc/output/local.py b/dvc/output/local.py index 703dee528..3c2627071 100644 --- a/dvc/output/local.py +++ b/dvc/output/local.py @@ -30,6 +30,10 @@ class OutputLOCAL(DependencyLOCAL): def cache(self): return self.project.cache.local.get(self.md5) + @property + def is_local(self): + return self.path.startswith(self.project.root_dir) + def dumpd(self): ret = super(OutputLOCAL, self).dumpd() ret[self.PARAM_CACHE] = self.use_cache @@ -69,7 +73,7 @@ class OutputLOCAL(DependencyLOCAL): self.project.logger.debug(msg.format(self.rel_path)) return - if self.path.startswith(self.project.root_dir): + if self.is_local: if self.project.scm.is_tracked(self.path): raise OutputAlreadyTrackedError(self.rel_path) @@ -80,11 +84,11 @@ class OutputLOCAL(DependencyLOCAL): def remove(self, ignore_remove=False): self.remote.remove(self.path_info) - if ignore_remove and self.use_cache: + if ignore_remove and self.use_cache and self.is_local: self.project.scm.ignore_remove(self.path) def move(self, out): - if self.use_cache: + if self.use_cache and self.is_local: self.project.scm.ignore_remove(self.path) self.remote.move(self.path_info, out.path_info) @@ -92,5 +96,5 @@ class OutputLOCAL(DependencyLOCAL): self.path_info = out.path_info self.save() - if self.use_cache: + if self.use_cache and self.is_local: self.project.scm.ignore(self.path)