Function: diff-hl-root-diff-reference-goto-hunk

diff-hl-root-diff-reference-goto-hunk is an interactive and natively compiled function defined in diff-hl.el.

Signature

(diff-hl-root-diff-reference-goto-hunk)

Documentation

Run VC diff command against the reference for the whole tree.

And if the current buffer is visiting a file, and it has changes, the diff buffer will show the position corresponding to its current line.

Key Bindings

This command is not in any keymaps.

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-root-diff-reference-goto-hunk ()
  "Run VC diff command against the reference for the whole tree.
And if the current buffer is visiting a file, and it has changes, the diff
buffer will show the position corresponding to its current line."
  (interactive)
  (defvar vc-sentinel-movepoint)
  (with-current-buffer (current-buffer)
    (let ((backend (vc-deduce-backend))
          (default-directory default-directory)
          rootdir fileset
          relname)
      (if backend
          (setq rootdir (vc-call-backend backend 'root default-directory)
                default-directory rootdir
                fileset `(,backend (,rootdir))
                relname (let ((file (diff-hl--buffer-file-name)))
                          (when file
                            (file-relative-name file rootdir))))
        (error "Directory is not version controlled"))
      (setq fileset (or fileset (vc-deduce-fileset)))
      (static-if (< emacs-major-version 28)
          (when buffer-file-name (vc-buffer-sync t))
        (vc-buffer-sync-fileset fileset t))
      (let* ((line (line-number-at-pos)))
        (vc-diff-internal
         (if (boundp 'vc-allow-async-diff)
             vc-allow-async-diff
           t)
         fileset diff-hl-reference-revision nil t)
        (vc-run-delayed (when relname
                          (diff-hl-diff-skip-to line relname)
                          (setq vc-sentinel-movepoint (point))))))))