Function: magit-blob-successor

magit-blob-successor is a byte-compiled function defined in magit-files.el.

Signature

(magit-blob-successor REV FILE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-files.el
(defun magit-blob-successor (rev file)
  (pcase rev
    ("{worktree}" nil)
    ("{index}" (list "{worktree}" file))
    (_ (let ((lines (magit-with-toplevel
                      (magit-git-lines "log" "--format=%h" "--name-only"
                                       "--follow" "HEAD" "--" file))))
         (catch 'found
           (while lines
             (if (equal (nth 2 lines) rev)
                 (throw 'found (list (nth 0 lines) (nth 1 lines)))
               (setq lines (nthcdr 2 lines))))
           (list (if (magit-anything-staged-p nil file) "{index}" "{worktree}")
                 file))))))