From 41343a06f56d790c820fa89fb02b8b76ec2ed08f Mon Sep 17 00:00:00 2001 From: Roger Crew Date: Sun, 25 Apr 2010 08:58:41 -0700 Subject: [PATCH] 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. --- magit.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/magit.el b/magit.el index 396ce2aa..a50ec7cf 100644 --- a/magit.el +++ b/magit.el @@ -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"))))