magit-show-branches shows wrong repository

If you do
.  magit-status on repository .../x
.  V (magit-show-branches)
.  magit-status on repository .../y
.  V (magit-show-branches)

you get the branch listing for repository .../x

Also, as a side issue, functionality of a buffer should not be
keyed off of the buffer name (in this case, renaming the buffer
should not change what V or g does).

The following patch deals with both of these.
This commit is contained in:
Roger Crew 2010-04-25 08:58:41 -07:00 committed by Phil Jackson
parent 7e22c2b044
commit 41343a06f5

View file

@ -3773,8 +3773,10 @@ With prefix force the removal even it it hasn't been merged."
(defun magit-show-branches ()
"Show all of the current branches in other-window."
(interactive)
(unless (string= (buffer-name) magit-branches-buffer-name)
(switch-to-buffer-other-window magit-branches-buffer-name))
(unless (eq major-mode 'magit-show-branches-mode)
(let ((topdir (magit-get-top-dir default-directory)))
(switch-to-buffer-other-window magit-branches-buffer-name)
(setq default-directory topdir)))
(let ((inhibit-read-only t)
(branches (mapcar 'magit--branch-view-details
(magit-git-lines "branch" "-va"))))