Function: diff-hl-git-index-revision

diff-hl-git-index-revision is a natively compiled function defined in diff-hl.el.

Signature

(diff-hl-git-index-revision FILE OBJECT-NAME)

Source Code

;; Defined in /nix/store/cfz56rl3lp066226i0bmmgiicls3gcq7-emacs-packages-deps/share/emacs/site-lisp/elpa/diff-hl-20261001.135/diff-hl.el
(defun diff-hl-git-index-revision (file object-name)
  (let ((filename (diff-hl-make-temp-file-name file
                                               (concat ";" object-name)
                                               'manual))
        (filebuf (get-file-buffer file)))
    (unless (file-exists-p filename)
      (with-current-buffer filebuf
        (let ((coding-system-for-read 'no-conversion)
              (coding-system-for-write 'no-conversion))
          (condition-case nil
              (with-temp-file filename
                (let ((outbuf (current-buffer)))
                  ;; Change buffer to be inside the repo.
                  (with-current-buffer filebuf
                    (vc-git-command outbuf 0 nil
                                    "cat-file" "blob" object-name))))
            (error
             (when (file-exists-p filename)
               (delete-file filename)))))))
    filename))