subrepo: use low-level git-diff-index for dirty()
authorEric Eisner <ede@mit.edu>
Tue, 14 Dec 2010 21:58:13 -0500
changeset 13153 dca5488f0e4f
parent 13152 70d80907e4b8
child 13154 e11c14f14491
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.
mercurial/subrepo.py
--- 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