emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master dd39c6f: ASCII-fy coding-system-for-read used for G


From: Dmitry Gutov
Subject: [Emacs-diffs] master dd39c6f: ASCII-fy coding-system-for-read used for Git commands
Date: Sun, 19 Jun 2016 19:08:29 +0000 (UTC)

branch: master
commit dd39c6fbeb299f0b203f01388e83f5e02767b8ff
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    ASCII-fy coding-system-for-read used for Git commands
    
    * lisp/vc/vc-git.el (vc-git--asciify-coding-system):
    New function.
    (vc-git-diff, vc-git-annotate-command): Use it.
---
 lisp/vc/vc-git.el |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 16cbeef..783ea89 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1084,6 +1084,13 @@ or BRANCH^ (where \"^\" can be repeated)."
               (cons 'vc-git-region-history-font-lock-keywords
                     (cdr font-lock-defaults))))
 
+(defun vc-git--asciify-coding-system ()
+  ;; Try to reconcile the content encoding with the encoding of Git's
+  ;; auxiliary output (which is ASCII or ASCII-compatible), bug#23595.
+  (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")
 
@@ -1091,6 +1098,7 @@ or BRANCH^ (where \"^\" can be repeated)."
   "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"))
@@ -1129,6 +1137,7 @@ or BRANCH^ (where \"^\" can be repeated)."
     table))
 
 (defun vc-git-annotate-command (file buf &optional rev)
+  (vc-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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]