summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/refs/symbolic.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py
index 550464e5..60cfe554 100644
--- a/git/refs/symbolic.py
+++ b/git/refs/symbolic.py
@@ -445,12 +445,14 @@ class SymbolicReference(object):
made_change = False
dropped_last_line = False
for line in reader:
+ line = line.decode(defenc)
+ _, _, line_ref = line.partition(' ')
+ line_ref = line_ref.strip()
# keep line if it is a comment or if the ref to delete is not
# in the line
# If we deleted the last line and this one is a tag-reference object,
# we drop it as well
- line = line.decode(defenc)
- if (line.startswith('#') or full_ref_path not in line) and \
+ if (line.startswith('#') or full_ref_path != line_ref) and \
(not dropped_last_line or dropped_last_line and not line.startswith('^')):
new_lines.append(line)
dropped_last_line = False