summaryrefslogtreecommitdiff
path: root/git/refs/head.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-12-08 16:01:35 +0100
committerSebastian Thiel <byronimo@gmail.com>2016-12-08 16:01:35 +0100
commitf21630bcf83c363916d858dd7b6cb1edc75e2d3b (patch)
tree9e5667dd959ab17bb124c29de5a1b21668dc8474 /git/refs/head.py
parent06914415434cf002f712a81712024fd90cea2862 (diff)
downloadgitpython-f21630bcf83c363916d858dd7b6cb1edc75e2d3b.tar.gz
fix(refs): handle quoted branch names
Fixes #550
Diffstat (limited to 'git/refs/head.py')
-rw-r--r--git/refs/head.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/git/refs/head.py b/git/refs/head.py
index 9a9a8596..9ad890db 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -8,6 +8,12 @@ from .reference import Reference
__all__ = ["HEAD", "Head"]
+def strip_quotes(string):
+ if string.startswith('"') and string.endswith('"'):
+ return string[1:-1]
+ return string
+
+
class HEAD(SymbolicReference):
"""Special case of a Symbolic Reference as it represents the repository's
@@ -152,7 +158,7 @@ class Head(Reference):
from .remote import RemoteReference
reader = self.config_reader()
if reader.has_option(self.k_config_remote) and reader.has_option(self.k_config_remote_ref):
- ref = Head(self.repo, Head.to_full_path(reader.get_value(self.k_config_remote_ref)))
+ ref = Head(self.repo, Head.to_full_path(strip_quotes(reader.get_value(self.k_config_remote_ref))))
remote_refpath = RemoteReference.to_full_path(join_path(reader.get_value(self.k_config_remote), ref.name))
return RemoteReference(self.repo, remote_refpath)
# END handle have tracking branch