comparison lisp/vc-git.el @ 99932:36e205658d72

(vc-git-diff-switches): New option. (vc-git-diff): Apply diff switches. (Bug#1386) Give it a basic doc string.
author Glenn Morris <rgm@gnu.org>
date Wed, 26 Nov 2008 02:55:28 +0000
parents b0dce7f34dda
children 961732603114
comparison
equal deleted inserted replaced
99931:4b9bb9aba3c8 99932:36e205658d72
107 (require 'cl) 107 (require 'cl)
108 (require 'vc) 108 (require 'vc)
109 (require 'vc-dir) 109 (require 'vc-dir)
110 (require 'grep)) 110 (require 'grep))
111 111
112 (defcustom vc-git-diff-switches t
113 "String or list of strings specifying extra switches for Git diff under VC.
114 If nil, use the value of `vc-diff-switches'.
115 If you want to force an empty list of arguments, use t."
116 :type '(choice (const :tag "Unspecified" nil)
117 (const :tag "None" t)
118 (string :tag "Argument String")
119 (repeat :tag "Argument List"
120 :value ("")
121 string))
122 :version "23.1"
123 :group 'vc)
124
112 (defvar git-commits-coding-system 'utf-8 125 (defvar git-commits-coding-system 'utf-8
113 "Default coding system for git commits.") 126 "Default coding system for git commits.")
114 127
115 ;;; BACKEND PROPERTIES 128 ;;; BACKEND PROPERTIES
116 129
499 (1+ (length (match-string 0 revision)))) 512 (1+ (length (match-string 0 revision))))
500 (t nil)))) 513 (t nil))))
501 (beginning-of-line)) 514 (beginning-of-line))
502 515
503 (defun vc-git-diff (files &optional rev1 rev2 buffer) 516 (defun vc-git-diff (files &optional rev1 rev2 buffer)
504 (let ((buf (or buffer "*vc-diff*"))) 517 "Get a difference report using Git between two revisions of FILES."
505 (if (and rev1 rev2) 518 (apply #'vc-git-command (or buffer "*vc-diff*") 1 files
506 (vc-git-command buf 1 files "diff-tree" "--exit-code" "-p" 519 (if (and rev1 rev2) "diff-tree" "diff-index")
507 rev1 rev2 "--") 520 "--exit-code"
508 (vc-git-command buf 1 files "diff-index" "--exit-code" "-p" 521 (append (vc-switches (if vc-git-diff-switches 'git) 'diff)
509 (or rev1 "HEAD") "--")))) 522 (list "-p" (or rev1 "HEAD") rev2 "--"))))
510 523
511 (defun vc-git-revision-table (files) 524 (defun vc-git-revision-table (files)
512 ;; What about `files'?!? --Stef 525 ;; What about `files'?!? --Stef
513 (let ((table (list "HEAD"))) 526 (let ((table (list "HEAD")))
514 (with-temp-buffer 527 (with-temp-buffer