diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -761,6 +761,9 @@ class gitsubrepo(abstractsubrepo): 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 @@ class gitsubrepo(abstractsubrepo): 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 @@ class gitsubrepo(abstractsubrepo): 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'])