diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index f35c84d..f7bd867 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1083,12 +1083,19 @@ vc-git-region-history-mode (cdr font-lock-defaults)))) +(defun git--asciify-coding-system () + (unless (let ((samp "Binary files differ")) + (string-equal samp (decode-coding-string + samp coding-system-for-read t))) + (setq coding-system-for-read 'undecided))) + (autoload 'vc-switches "vc") (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")) + (git--asciify-coding-system) (if rev2 ;; Diffing against the empty tree. (unless rev1 (setq rev1 "4b825dc642cb6eb9a060e54bf8d69288fbee4904")) @@ -1127,6 +1134,7 @@ vc-git-revision-completion-table table)) (defun vc-git-annotate-command (file buf &optional rev) + (git--asciify-coding-system) (let ((name (file-relative-name file))) (apply #'vc-git-command buf 'async nil "blame" "--date=short" (append (vc-switches 'git 'annotate)