emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 4bfa149 3/7: Allow using --patience through vc-git-diff-sw


From: Dmitry Gutov
Subject: [elpa] master 4bfa149 3/7: Allow using --patience through vc-git-diff-switches
Date: Thu, 23 Jun 2016 01:18:25 +0000 (UTC)

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

    Allow using --patience through vc-git-diff-switches
    
    Closes #9.
---
 README.md  |   10 ++++++++++
 diff-hl.el |   11 +++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index b8bbe3a..725466b 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,16 @@ Notes
   it's only accurate when the buffer is in saved state. Check out
   `diff-hl-flydiff-mode`, it aims to handle unsaved buffers as well.
 
+* To use an
+  [alternative diff 
algorithm](http://stackoverflow.com/questions/32365271/whats-the-difference-between-git-diff-patience-and-git-diff-histogram)
+  with Git, add a corresponding argument to `vc-git-diff-switches`,
+  e.g. `(setq vc-git-diff-switches '("--histogram"))`. Using the
+  `diff.algorithm` option doesn't work
+  [because](http://article.gmane.org/gmane.comp.version-control.git/294622)
+  `vc-git-diff` calls `git diff-index`. `diff-hl-flydiff-mode` does
+  not support alternative algorithms, because it uses the external
+  `diff` program.
+
 * We conflict with other modes when they put indicators on the fringe,
   such as [Flycheck](https://github.com/flycheck/flycheck). This is
   rarely a significant problem, since if you're using such a mode,
diff --git a/diff-hl.el b/diff-hl.el
index 106a487..c52bf0e 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -209,8 +209,15 @@
 (defvar vc-svn-diff-switches)
 
 (defmacro diff-hl-with-diff-switches (body)
-  ;; https://github.com/dgutov/diff-hl/issues/67
-  `(let ((vc-git-diff-switches '("-U0"))
+  `(let ((vc-git-diff-switches
+          ;; https://github.com/dgutov/diff-hl/issues/67
+          (cons "-U0"
+                ;; https://github.com/dgutov/diff-hl/issues/9
+                (and (listp vc-git-diff-switches)
+                     (cl-remove-if-not
+                      (lambda (arg)
+                        (member arg '("--histogram" "--patience" "--minimal")))
+                      vc-git-diff-switches))))
          (vc-hg-diff-switches nil)
          (vc-svn-diff-switches nil)
          (vc-diff-switches '("-U0"))



reply via email to

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