diff --git a/git_upstream/lib/drop.py b/git_upstream/lib/drop.py index 7a7aca4..99a2b1f 100644 --- a/git_upstream/lib/drop.py +++ b/git_upstream/lib/drop.py @@ -69,7 +69,7 @@ class Drop(LogDedentMixin, GitMixin): self._author = author # test that we can use this git repo - if not self.is_detached(): + if self.is_detached(): raise DropError("In 'detached HEAD' state") # To Do: check if it possible and useful. diff --git a/git_upstream/lib/importupstream.py b/git_upstream/lib/importupstream.py index ed76f73..dc0772e 100644 --- a/git_upstream/lib/importupstream.py +++ b/git_upstream/lib/importupstream.py @@ -48,7 +48,7 @@ class ImportUpstream(LogDedentMixin, GitMixin): super(ImportUpstream, self).__init__(*args, **kwargs) # test that we can use this git repo - if not self.is_detached(): + if self.is_detached(): raise ImportUpstreamError("In 'detached HEAD' state") if self.repo.bare: diff --git a/git_upstream/lib/supersede.py b/git_upstream/lib/supersede.py index aa10ef6..423d32c 100644 --- a/git_upstream/lib/supersede.py +++ b/git_upstream/lib/supersede.py @@ -62,7 +62,7 @@ class Supersede(LogDedentMixin, GitMixin): raise SupersedeError("Commit should be provided") # test that we can use this git repo - if not self.is_detached(): + if self.is_detached(): raise SupersedeError("In 'detached HEAD' state") # To Do: check if it possible and useful. diff --git a/git_upstream/lib/utils.py b/git_upstream/lib/utils.py index b370063..ae34dda 100644 --- a/git_upstream/lib/utils.py +++ b/git_upstream/lib/utils.py @@ -53,7 +53,7 @@ class GitMixin(object): return self.__git def is_detached(self): - return self.git.symbolic_ref("HEAD", q=True, with_exceptions=False) + return not self.git.symbolic_ref("HEAD", q=True, with_exceptions=False) def get_name(self, sha1, pattern=None): """