Function: vc-git-diff
vc-git-diff is a byte-compiled function defined in vc-git.el.gz.
Signature
(vc-git-diff FILES &optional REV1 REV2 BUFFER ASYNC)
Documentation
Get a difference report using Git between two revisions of FILES.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-diff (files &optional rev1 rev2 buffer async)
"Get a difference report using Git between two revisions of FILES."
(let (process-file-side-effects
(command "diff-tree"))
(vc-git--asciify-coding-system)
(if rev2
(unless rev1 (setq rev1 vc-git--empty-tree))
(setq command "diff-index")
(unless rev1
;; If there aren't any commits yet then there is no HEAD.
;; So diff against the empty tree object.
(setq rev1 (if (vc-git--empty-db-p) vc-git--empty-tree "HEAD"))))
(if vc-git-diff-switches
(apply #'vc-git-command (or buffer "*vc-diff*")
(if async 'async 1)
files
command
"--exit-code"
(append (vc-switches 'git 'diff)
(list "-p" (or rev1 "HEAD") rev2 "--")))
(vc-git-command (or buffer "*vc-diff*") 1 files
"difftool" "--exit-code" "--no-prompt" "-x"
(concat "diff "
(mapconcat #'identity
(vc-switches nil 'diff) " "))
rev1 rev2 "--"))))