# HG changeset patch # User Paul Molodowitch # Date 1306337938 25200 # Node ID 96f1c1b141549be3671e567f00d9e228a49069d6 # Parent 80c599eee3f3b867cdd2a10cf62d3da19f8f2d32 subrepo: bare git repos considered dirty Currently, if there is a bare git subrepo, but it is at the "right" revision, calling dirty() will error because diff-index does not work on bare repos. This patch makes it so bare subrepos are always considered dirty. diff -r 80c599eee3f3 -r 96f1c1b14154 mercurial/subrepo.py --- a/mercurial/subrepo.py Thu May 26 00:53:23 2011 +0300 +++ b/mercurial/subrepo.py Wed May 25 08:38:58 2011 -0700 @@ -761,6 +761,9 @@ base = self._gitcommand(['merge-base', r1, r2]) return base == r1 + def _gitisbare(self): + return self._gitcommand(['config', '--bool', 'core.bare']) == 'true' + def _gitbranchmap(self): '''returns 2 things: a map from git branch to revision @@ -823,6 +826,8 @@ def dirty(self, ignoreupdate=False): if self._gitmissing(): return True + if self._gitisbare(): + return True if not ignoreupdate and self._state[1] != self._gitstate(): # different version checked out return True @@ -834,7 +839,7 @@ source, revision, kind = state self._fetch(source, revision) # if the repo was set to be bare, unbare it - if self._gitcommand(['config', '--bool', 'core.bare']) == 'true': + if self._gitisbare(): self._gitcommand(['config', 'core.bare', 'false']) if self._gitstate() == revision: self._gitcommand(['reset', '--hard', 'HEAD'])