branch: elpa/magit
commit 82b58b9116de776b9e60748332a7109d5864e08a
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-blob-visit: Take two arguments
    
    Like related functions already do.
---
 lisp/magit-files.el | 18 ++++++++----------
 lisp/magit-log.el   |  8 ++++----
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/lisp/magit-files.el b/lisp/magit-files.el
index e60e87a43c8..d31cfc6ca2e 100644
--- a/lisp/magit-files.el
+++ b/lisp/magit-files.el
@@ -386,7 +386,7 @@ in a single window."
     ((not file)
      (user-error "Buffer isn't visiting a file or blob"))
     ([next (magit-blob-successor rev file)]
-     (magit-blob-visit next))
+     (apply #'magit-blob-visit next))
     ((user-error "You have reached the end of time"))))
 
 (defun magit-blob-previous ()
@@ -398,7 +398,7 @@ in a single window."
     ((not file)
      (user-error "Buffer isn't visiting a file or blob"))
     ([prev (magit-blob-ancestor rev file)]
-     (magit-blob-visit prev))
+     (apply #'magit-blob-visit prev))
     ((user-error "You have reached the beginning of time"))))
 
 ;;;###autoload
@@ -411,14 +411,12 @@ the same location in the respective file in the working 
tree."
       (magit-find-file--internal "{worktree}" file #'pop-to-buffer-same-window)
     (user-error "Not visiting a blob")))
 
-(defun magit-blob-visit (blob-or-file)
-  (if (stringp blob-or-file)
-      (magit-find-file "{worktree}" blob-or-file)
-    (pcase-let ((`(,rev ,file) blob-or-file))
-      (magit-find-file rev file)
-      (apply #'message "%s (%s %s ago)"
-             (magit-rev-format "%s" rev)
-             (magit--age (magit-rev-format "%ct" rev))))))
+(defun magit-blob-visit (rev file)
+  (magit-find-file rev file)
+  (unless (member rev '("{worktree}" "{index}"))
+    (apply #'message "%s (%s %s ago)"
+           (magit-rev-format "%s" rev)
+           (magit--age (magit-rev-format "%ct" rev)))))
 
 (defun magit-blob-ancestor (rev file)
   (nth (if rev 1 0)
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index e26c7bb6d08..7e2a6f20628 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -32,7 +32,7 @@
 (require 'magit-diff)
 
 (declare-function magit--any-wip-mode-enabled-p "magit-wip" ())
-(declare-function magit-blob-visit "magit-files" (blob-or-file))
+(declare-function magit-blob-visit "magit-files" (rev file))
 (declare-function magit-cherry-apply "magit-sequence" (commit &optional args))
 (declare-function magit-insert-head-branch-header "magit-status"
                   (&optional branch))
@@ -1588,9 +1588,9 @@ See also info node `(magit)Section Movement'."
              (with-selected-window (get-buffer-window buf)
                (with-current-buffer buf
                  (save-excursion
-                   (magit-blob-visit (list (magit-rev-parse rev)
-                                           (magit-file-relative-name
-                                            magit-buffer-file-name)))))))))))))
+                   (magit-blob-visit (magit-rev-parse rev)
+                                     (magit-file-relative-name
+                                      magit-buffer-file-name))))))))))))
 
 (defun magit-log-goto-commit-section (rev)
   (let ((abbrev (magit-rev-format "%h" rev)))

Reply via email to