我收到一个错误,同时试图使用gitpython来检查仓库是肮脏的,即还没有提交变更为跟踪文件:gitpython错误检查时,如果回购脏
import git
repo = git.Repo('')
print repo.is_dirty()
错误:
Traceback (most recent call last):
File "C:\dev\my_prog\test.py", line 8, in <module>
print repo.is_dirty()
File "C:\Python27\lib\site-packages\gitpython-0.3.2.rc1-py2.7.egg\git\repo\base.py", line 502, in is_dirty
len(self.git.diff('HEAD', '--cached', *default_args)):
File "C:\Python27\lib\site-packages\gitpython-0.3.2.rc1-py2.7.egg\git\cmd.py", line 227, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "C:\Python27\lib\site-packages\gitpython-0.3.2.rc1-py2.7.egg\git\cmd.py", line 456, in _call_process
return self.execute(call, **_kwargs)
File "C:\Python27\lib\site-packages\gitpython-0.3.2.rc1-py2.7.egg\git\cmd.py", line 377, in execute
raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git diff HEAD --cached --abbrev=40 --full-index --raw' returned exit status 1:
怎么回事?可能是什么问题呢?
通知我工作在Windows 7 msysgit
这是在我的情况下的情况:没有初始提交基本上 –