Remove "remotes/" prefix from remote branch names

git cannot find a branch named "remotes/repository/branch" with
most (all?) of its commands, e.g. "git branch -d -r ..." or "git
merge".
This commit is contained in:
Moritz Bunkus 2010-06-20 11:50:14 +02:00 committed by Phil Jackson
parent 8bcbcb369e
commit 043f4383de

View file

@ -4025,7 +4025,12 @@ Return values:
(defun magit--branch-name-from-line (line) (defun magit--branch-name-from-line (line)
"Extract the branch name from line LINE of 'git branch' output." "Extract the branch name from line LINE of 'git branch' output."
(get-text-property 0 'branch-name line)) (let ((branch (get-text-property 0 'branch-name line)))
(if (and branch
(get-text-property 0 'remote line)
(string-match-p "^remotes/" branch))
(substring branch 8)
branch)))
(defun magit--branch-name-at-point () (defun magit--branch-name-at-point ()
"Get the branch name in the line at point." "Get the branch name in the line at point."