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
;; Diffing against the empty tree.
(unless rev1 (setq rev1 "4b825dc642cb6eb9a060e54bf8d69288fbee4904"))
(setq command "diff-index")
(unless rev1 (setq rev1 "HEAD")))
(if vc-git-diff-switches
(apply #'vc-git-command (or buffer "*vc-diff*")
1 ; bug#21969
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 "--"))))