From 9ca54526037cb4fb73186cac3f26f601ac0dcd09 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Tue, 23 Jul 2019 15:01:46 -0500 Subject: [PATCH] scm: reset tracked files after every operation Fix #1475 --- dvc/repo/scm_context.py | 1 + dvc/scm/base.py | 5 +++++ dvc/scm/git/__init__.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/dvc/repo/scm_context.py b/dvc/repo/scm_context.py index b5985b117..6f189c597 100644 --- a/dvc/repo/scm_context.py +++ b/dvc/repo/scm_context.py @@ -2,6 +2,7 @@ def scm_context(method): def run(repo, *args, **kw): try: result = method(repo, *args, **kw) + repo.scm.reset_tracked_files() repo.scm.reset_ignores() repo.scm.remind_to_track() return result diff --git a/dvc/scm/base.py b/dvc/scm/base.py index d7f5333e3..e52fafe99 100644 --- a/dvc/scm/base.py +++ b/dvc/scm/base.py @@ -126,6 +126,11 @@ class Base(object): Method to reset in-memory ignore storing mechanism. """ + def reset_tracked_files(self): + """ + Method to reset in-memory tracked files storing mechanism. + """ + def remind_to_track(self): """ Method to remind user to track newly created files handled by scm diff --git a/dvc/scm/git/__init__.py b/dvc/scm/git/__init__.py index 339e64339..04b42747d 100644 --- a/dvc/scm/git/__init__.py +++ b/dvc/scm/git/__init__.py @@ -245,6 +245,9 @@ class Git(Base): def reset_ignores(self): self.ignored_paths = [] + def reset_tracked_files(self): + self.files_to_track = [] + def remind_to_track(self): if not self.files_to_track: return