diff options
-rw-r--r-- | git/refs/reference.py | 2 | ||||
-rw-r--r-- | git/refs/symbolic.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/git/refs/reference.py b/git/refs/reference.py index 0745b721..72494e0a 100644 --- a/git/refs/reference.py +++ b/git/refs/reference.py @@ -18,7 +18,7 @@ def require_remote_ref_path(func): """A decorator raising a TypeError if we are not a valid remote, based on the path""" def wrapper(self, *args): - if not self.path.startswith(self._remote_common_path_default + "/"): + if not self.is_remote(): raise ValueError("ref path does not point to a remote reference: %s" % self.path) return func(self, *args) #END wrapper diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 9a95b7f0..fcb1336e 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -630,3 +630,7 @@ class SymbolicReference(object): # END exception handling # END for each type to try raise ValueError("Could not find reference type suitable to handle path %r" % path) + + def is_remote(self): + """:return: True if this symbolic reference points to a remote branch""" + return self.path.startswith(self._remote_common_path_default + "/") |