Merge pull request #825 from efiop/master

scm: print error if GitPython bug raises
This commit is contained in:
Ruslan Kuprieiev
2018-06-29 01:45:44 +03:00
committed by GitHub
+9 -1
View File
@@ -1,6 +1,7 @@
import os
from dvc.exceptions import DvcException
from dvc.logger import Logger
class SCMError(DvcException):
@@ -131,7 +132,14 @@ class Git(Base):
fd.writelines(filtered)
def add(self, paths):
self.repo.index.add(paths)
# NOTE: GitPython is not currently able to handle index version >= 3.
# See https://github.com/iterative/dvc/issues/610 for more details.
try:
self.repo.index.add(paths)
except AssertionError as exc:
msg = 'Failed to add \'{}\' to git. You can add those files manually using \'git add\'. '
msg += 'See \'https://github.com/iterative/dvc/issues/610\' for more details.'
Logger.error(msg.format(str(paths)), exc)
def commit(self, msg):
self.repo.index.commit(msg)