From 7dad3be9589dc80b5257d05a672b9e57e59fd593 Mon Sep 17 00:00:00 2001 From: Alexey Voinov Date: Tue, 16 Mar 2010 15:42:26 +0300 Subject: [PATCH 1/3] Show the right buffer when showing stash --- magit.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magit.el b/magit.el index 4a2e2e65..5df72c29 100644 --- a/magit.el +++ b/magit.el @@ -3304,7 +3304,7 @@ Prefix arg means justify as well." (pop-to-buffer "*magit-commit*")) ((stash) (magit-show-stash info) - (pop-to-buffer "*magit-diff*")) + (pop-to-buffer "*magit-stash*")) ((topic) (magit-checkout info)))) From f75486437362e8ae104c366083e3cfc9ca9da5db Mon Sep 17 00:00:00 2001 From: Alexey Voinov Date: Tue, 16 Mar 2010 15:47:36 +0300 Subject: [PATCH 2/3] Don't show empty *magit-stash* buffer. --- magit.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index 5df72c29..03d78c35 100644 --- a/magit.el +++ b/magit.el @@ -2916,7 +2916,9 @@ Prefix arg means justify as well." (setq stash (magit-section-info stash))) (let ((dir default-directory) (buf (get-buffer-create "*magit-stash*"))) - (cond ((equal magit-currently-shown-stash stash) + (cond ((and (equal magit-currently-shown-stash stash) + (with-current-buffer buf + (> (length (buffer-string)) 1))) (let ((win (get-buffer-window buf))) (cond ((not win) (display-buffer buf)) From 6e9e517e6f6711598de7dae9e8d4810ed0ab7244 Mon Sep 17 00:00:00 2001 From: Alexey Voinov Date: Tue, 16 Mar 2010 16:18:16 +0300 Subject: [PATCH 3/3] Use sha1 to differetiate between stashes, not stash number --- magit.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/magit.el b/magit.el index 03d78c35..cb9d38f1 100644 --- a/magit.el +++ b/magit.el @@ -2915,8 +2915,9 @@ Prefix arg means justify as well." (when (magit-section-p stash) (setq stash (magit-section-info stash))) (let ((dir default-directory) - (buf (get-buffer-create "*magit-stash*"))) - (cond ((and (equal magit-currently-shown-stash stash) + (buf (get-buffer-create "*magit-stash*")) + (stash-id (magit-git-string "rev-list" "-1" stash))) + (cond ((and (equal magit-currently-shown-stash stash-id) (with-current-buffer buf (> (length (buffer-string)) 1))) (let ((win (get-buffer-window buf))) @@ -2926,7 +2927,7 @@ Prefix arg means justify as well." (with-selected-window win (funcall scroll)))))) (t - (setq magit-currently-shown-stash stash) + (setq magit-currently-shown-stash stash-id) (display-buffer buf) (with-current-buffer buf (set-buffer buf)