(require 'vc-dir)
(require 'grep))
+(defcustom vc-git-diff-switches t
+ "String or list of strings specifying switches for Git diff under VC.
+If nil, use the value of `vc-diff-switches'. If t, use no switches."
+ :type '(choice (const :tag "Unspecified" nil)
+ (const :tag "None" t)
+ (string :tag "Argument String")
+ (repeat :tag "Argument List" :value ("") string))
+ :version "23.1"
+ :group 'vc)
+
(defvar git-commits-coding-system 'utf-8
"Default coding system for git commits.")
(if (eq 0 (logand ?\111 old-perm)) "+x" "-x"))
'face 'font-lock-type-face))
-(defun vc-git-status-printer (info)
+(defun vc-git-dir-printer (info)
"Pretty-printer for the vc-dir-fileinfo structure."
(let* ((isdir (vc-dir-fileinfo->directory info))
(state (if isdir "" (vc-dir-fileinfo->state info)))
(t 'font-lock-variable-name-face))
'mouse-face 'highlight)
" " (vc-git-permissions-as-string old-perm new-perm)
- " "
+ " "
(propertize (vc-git-escape-file-name (vc-dir-fileinfo->name info))
'face (if isdir 'font-lock-comment-delimiter-face 'font-lock-function-name-face)
'help-echo
"Return a list of (FILE STATE EXTRA) entries for FILES in DIR."
(vc-git-dir-status-goto-stage 'update-index files update-function))
-(defun vc-git-status-extra-headers (dir)
+(defun vc-git-dir-extra-headers (dir)
(let ((str (with-output-to-string
(with-current-buffer standard-output
(vc-git--out-ok "symbolic-ref" "HEAD")))))
or BRANCH^ (where \"^\" can be repeated)."
(goto-char (point-min))
(when revision
- (search-forward "\ncommit" nil t
+ (search-forward (format "\ncommit %s" revision) nil t
(cond ((string-match "~\\([0-9]\\)$" revision)
(1+ (string-to-number (match-string 1 revision))))
((string-match "\\^+$" revision)
(beginning-of-line))
(defun vc-git-diff (files &optional rev1 rev2 buffer)
- (let ((buf (or buffer "*vc-diff*")))
- (if (and rev1 rev2)
- (vc-git-command buf 1 files "diff-tree" "--exit-code" "-p"
- rev1 rev2 "--")
- (vc-git-command buf 1 files "diff-index" "--exit-code" "-p"
- (or rev1 "HEAD") "--"))))
+ "Get a difference report using Git between two revisions of FILES."
+ (apply #'vc-git-command (or buffer "*vc-diff*") 1 files
+ (if (and rev1 rev2) "diff-tree" "diff-index")
+ "--exit-code"
+ (append (vc-switches 'git 'diff)
+ (list "-p" (or rev1 "HEAD") rev2 "--"))))
(defun vc-git-revision-table (files)
;; What about `files'?!? --Stef