branch: elpa/magit
commit 5d1d77066b0550180af152eae1c8049da682da53
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit-diff-visit-file--noselect: Always use magit-find-file-noselect
---
 lisp/magit-diff.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 0da0101e1c1..d14412fedff 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1760,15 +1760,16 @@ the Magit-Status buffer for DIRECTORY."
        (rev  (if goto-from
                  (magit-diff-visit--range-from spec)
                (magit-diff-visit--range-to spec)))
-       (buffer (if (or goto-worktree
-                       (equal magit-buffer-typearg "--no-index")
-                       (and (not (stringp rev))
-                            (or magit-diff-visit-avoid-head-blob
-                                (not goto-from))))
-                   (or (get-file-buffer file)
-                       (find-file-noselect file))
-                 (magit-find-file-noselect (if (stringp rev) rev "HEAD")
-                                           file))))
+       (buffer (magit-find-file-noselect
+                (cond ((or goto-worktree
+                           (equal magit-buffer-typearg "--no-index")
+                           (and (not (stringp rev))
+                                (or magit-diff-visit-avoid-head-blob
+                                    (not goto-from))))
+                       "{worktree}")
+                      ((stringp rev) rev)
+                      ("HEAD"))
+                file)))
     (if line
         (with-current-buffer buffer
           (cond ((eq rev 'staged)

Reply via email to