branch: elpa/git-commit commit 9d4192b7b12c6b7f0664d99c4f876cfcc0a30ad4 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Fix visiting file from buffer created with magit-diff-paths Closes #5116. --- lisp/magit-diff.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index f2d017073a..7c07e5fb3c 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -1673,6 +1673,7 @@ the Magit-Status buffer for DIRECTORY." (magit-diff-visit--range-from spec) (magit-diff-visit--range-to spec))) (buf (if (or goto-worktree + (equal magit-buffer-typearg "--no-index") (and (not (stringp rev)) (or magit-diff-visit-avoid-head-blob (not goto-from)))) @@ -1705,9 +1706,10 @@ the Magit-Status buffer for DIRECTORY." (magit-current-section) nil) (oref file-section source)) (oref file-section value)))) - (if expand - (expand-file-name file (magit-toplevel)) - file) + (cond ((equal magit-buffer-typearg "--no-index") + (concat "/" file)) + (expand (expand-file-name file (magit-toplevel))) + (file)) (when assert (user-error "No file at point"))))