diff --git a/project.py b/project.py index d336f990..114ff491 100644 --- a/project.py +++ b/project.py @@ -1044,12 +1044,15 @@ class Project(object): if head == revid: # No changes; don't do anything further. + # Except if the head needs to be detached # - return + if not syncbuf.detach_head: + return + else: + lost = self._revlist(not_rev(revid), HEAD) + if lost: + syncbuf.info(self, "discarding %d commits", len(lost)) - lost = self._revlist(not_rev(revid), HEAD) - if lost: - syncbuf.info(self, "discarding %d commits", len(lost)) try: self._Checkout(revid, quiet=True) except GitError, e: