Put branch name in text properties.

This commit is contained in:
Phil Jackson 2010-03-30 23:07:09 +01:00
parent b261669efe
commit 1ae36db891

View file

@ -3568,9 +3568,7 @@ Prefix arg means justify as well."
(defun magit--branch-name-from-line (line)
"Extract the branch name from one line of 'git branch' output.
Will remove the 'remotes/' prefix if it exists."
(save-match-data
(if (string-match " \\([^ ]+\\)$" line)
(match-string 1 line))))
(get-text-property 0 'branch-name line))
(defun magit--branch-name-at-point ()
"Get the branch name in the line at point."
@ -3656,6 +3654,7 @@ With prefix force the removal even it it hasn't been merged."
(insert
(mapconcat
(lambda (b)
(propertize
(concat
(cdr (assoc 'current b))
(propertize (or (cdr (assoc 'sha1 b))
@ -3664,7 +3663,8 @@ With prefix force the removal even it it hasn't been merged."
" "
(cdr (assoc 'branch b))
(when (assoc 'other-ref b)
(concat " (" (cdr (assoc 'other-ref b)) ")"))))
(concat " (" (cdr (assoc 'other-ref b)) ")")))
'branch-name (cdr (assoc 'branch b))))
branches
"\n")))