subrepo: use low-level git-diff-index for dirty()
Despite its name, git-diff-index compares a revision to the files in the
working directory. This seems way less sketchy and more future proof than
parsing human-readable git-status.
--- a/mercurial/subrepo.py Tue Dec 14 21:56:43 2010 -0500
+++ b/mercurial/subrepo.py Tue Dec 14 21:58:13 2010 -0500
@@ -718,9 +718,8 @@
if self._state[1] != self._gitstate(): # version checked out changed?
return True
# check for staged changes or modified files; ignore untracked files
- status = self._gitcommand(['status'])
- return ('\n# Changed but not updated:' in status or
- '\n# Changes to be committed:' in status)
+ out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
+ return code == 1
def get(self, state):
source, revision, kind = state