我在尝试使用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:
怎么来的?可能是什么问题呢?
注意我正在使用msysgit在 Windows 7 上工作