dvc: print warning when file/dir is empty

Fixes #677

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-05-15 22:57:35 +03:00
parent ad54ec2091
commit 1bd9e9fbb1
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -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
+1 -1
View File
@@ -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