diff --git a/dvc/output.py b/dvc/output.py index d32a334f1..95d3f2dea 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -98,6 +98,10 @@ class Dependency(object): if not os.path.isfile(self.path) and not os.path.isdir(self.path): raise CmdOutputIsNotFileOrDirError(self.rel_path) + if (os.path.isfile(self.path) and os.path.getsize(self.path) == 0) or \ + (os.path.isdir(self.path) and len(os.listdir(self.path)) == 0): + self.project.logger.warn("File/directory '{}' is empty.".format(self.rel_path)) + self.md5 = self.project.state.update(self.path) @staticmethod diff --git a/dvc/scm.py b/dvc/scm.py index 79a7572c7..46a95ff9c 100644 --- a/dvc/scm.py +++ b/dvc/scm.py @@ -87,7 +87,7 @@ class Git(Base): gitignore = os.path.abspath(os.path.realpath(gitignore)) if not gitignore.startswith(self.root_dir): - raise FileNotInRepoError() + raise FileNotInRepoError(path) return entry, gitignore