Function: magit-blob-ancestor

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

Signature

(magit-blob-ancestor REV FILE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-files.el
(defun magit-blob-ancestor (rev file)
  (pcase rev
    ((and "{worktree}" (guard (magit-anything-staged-p nil file)))
     (list "{index}" file))
    ((or "{worktree}" "{index}")
     (list (magit-rev-abbrev "HEAD") file))
    (_ (nth (if rev 1 0)
            (magit-with-toplevel
              (seq-partition
               (magit-git-lines "log" "-2" "--format=%h" "--name-only"
                                "--follow" (or rev "HEAD") "--" file)
               2))))))