unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19099: Diff options with vc-git
@ 2014-11-18 19:09 Glenn Morris
  2014-11-18 19:17 ` Eli Zaretskii
  2014-11-19  3:03 ` bug#19099: [PATCH] vc-git: Support `diff-switches' Rüdiger Sonderfeld
  0 siblings, 2 replies; 11+ messages in thread
From: Glenn Morris @ 2014-11-18 19:09 UTC (permalink / raw)
  To: 19099

Package: emacs
Version: 24.4

I would like to use context diffs with vc-diff. Or pretend I said "any
GNU diff option that git diff does not support".

If I

(setq diff-switches '("-c" -w"))

then it works fine with vc-bzr, which correctly converts these into
"--diff-options" for bzr diff. Same for vc-svn, which automatically adds
--diff-cmd.

With vc-git this does nothing. Setting vc-git-diff-switches to nil
doesn't do the right thing: it passes -c to "git diff", which
interprets it as "--combined", which is not what I wanted.

IIUC there's basically no way to get this with git diff, I have to use
  
   difftool -x "diff -c"

(which seems to parse its -x argument on whitespace, yuck).

So, TLDR:

I'd like an option to call difftool instead of diff in vc-git-diff, please.
If it was consistent with eg vc-svn, this would happen by default when
vc-git-diff-switches was nil.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: Diff options with vc-git
  2014-11-18 19:09 bug#19099: Diff options with vc-git Glenn Morris
@ 2014-11-18 19:17 ` Eli Zaretskii
  2014-11-18 19:27   ` Glenn Morris
  2014-11-19  3:03 ` bug#19099: [PATCH] vc-git: Support `diff-switches' Rüdiger Sonderfeld
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2014-11-18 19:17 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 19099

> From: Glenn Morris <rgm@gnu.org>
> Date: Tue, 18 Nov 2014 14:09:53 -0500
> 
> IIUC there's basically no way to get this with git diff, I have to use
>   
>    difftool -x "diff -c"
> 
> (which seems to parse its -x argument on whitespace, yuck).
> 
> So, TLDR:
> 
> I'd like an option to call difftool instead of diff in vc-git-diff, please.
> If it was consistent with eg vc-svn, this would happen by default when
> vc-git-diff-switches was nil.

You can make an alias as described here:

  http://stackoverflow.com/questions/3129514/how-to-make-git-diff-create-a-context-format-diff

and then invoke that alias instead of "diff".





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: Diff options with vc-git
  2014-11-18 19:17 ` Eli Zaretskii
@ 2014-11-18 19:27   ` Glenn Morris
  2014-11-18 19:57     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2014-11-18 19:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 19099

Eli Zaretskii wrote:

> You can make an alias as described here:
>
>   http://stackoverflow.com/questions/3129514/how-to-make-git-diff-create-a-context-format-diff
>
> and then invoke that alias instead of "diff".

Git aliases cannot override built-in git commands. (By design, wontfix, etc.)
So I cannot make "git diff" do what I want.

If you think otherwise, please give me a concrete example of how I can
configure Emacs to do what I want.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: Diff options with vc-git
  2014-11-18 19:27   ` Glenn Morris
@ 2014-11-18 19:57     ` Eli Zaretskii
  2014-11-18 20:01       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2014-11-18 19:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 19099

> From: Glenn Morris <rgm@gnu.org>
> Cc: 19099@debbugs.gnu.org
> Date: Tue, 18 Nov 2014 14:27:22 -0500
> 
> > and then invoke that alias instead of "diff".
> 
> Git aliases cannot override built-in git commands. (By design, wontfix, etc.)
> So I cannot make "git diff" do what I want.

I said "alias +instead_ of diff", didn't I?

> If you think otherwise, please give me a concrete example of how I can
> configure Emacs to do what I want.

Introduce a defcustom that will allow to all "git SOMETHING" when VC
wants a diff command.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: Diff options with vc-git
  2014-11-18 19:57     ` Eli Zaretskii
@ 2014-11-18 20:01       ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2014-11-18 20:01 UTC (permalink / raw)
  To: rgm; +Cc: 19099

> Date: Tue, 18 Nov 2014 21:57:57 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 19099@debbugs.gnu.org
> 
> Introduce a defcustom that will allow to all "git SOMETHING" when VC
> wants a diff command.                    ^^^

I meant "call", of course.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-18 19:09 bug#19099: Diff options with vc-git Glenn Morris
  2014-11-18 19:17 ` Eli Zaretskii
@ 2014-11-19  3:03 ` Rüdiger Sonderfeld
  2014-11-19  4:36   ` Glenn Morris
  1 sibling, 1 reply; 11+ messages in thread
From: Rüdiger Sonderfeld @ 2014-11-19  3:03 UTC (permalink / raw)
  To: 19099

This patch should add support for it.  Please check if it works for you.

ChangeLog:

Fix bug#19099.
* lisp/vc/vc-git.el (vc-git-diff): Use "difftool -x diff" with
  `diff-switches' if `vc-git-diff-switches' is nil.
---
 lisp/vc/vc-git.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index be0211c..3b11a3c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -994,11 +994,18 @@ (autoload 'vc-switches "vc")
 (defun vc-git-diff (files &optional rev1 rev2 buffer)
   "Get a difference report using Git between two revisions of FILES."
   (let (process-file-side-effects)
-    (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 "--")))))
+    (if vc-git-diff-switches
+        (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 "--")))
+      (vc-git-command (or buffer "*vc-diff*") 1 files
+                      "difftool" "--exit-code" "--no-prompt" "-x"
+                      (concat "diff "
+                              (mapconcat 'identity
+                                         (vc-switches nil 'diff) " "))
+                      (or rev1 "HEAD") rev2 "--"))))
 
 (defun vc-git-revision-table (_files)
   ;; What about `files'?!?  --Stef
-- 
2.1.3






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-19  3:03 ` bug#19099: [PATCH] vc-git: Support `diff-switches' Rüdiger Sonderfeld
@ 2014-11-19  4:36   ` Glenn Morris
  2014-11-19 11:13     ` Rüdiger Sonderfeld
  0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2014-11-19  4:36 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 19099


Thanks, works for me, and seems to neatly avoid being an incompatible
change wrt vc-git-diff-switches being non-nil and non-t.
BTW, I appreciate how you often try to improve git-related things.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-19  4:36   ` Glenn Morris
@ 2014-11-19 11:13     ` Rüdiger Sonderfeld
  2014-11-19 18:30       ` Glenn Morris
  0 siblings, 1 reply; 11+ messages in thread
From: Rüdiger Sonderfeld @ 2014-11-19 11:13 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 19099-done, Rüdiger Sonderfeld

tags 19099 fixed

On Tuesday 18 November 2014 23:36:11 Glenn Morris wrote:
> Thanks, works for me, and seems to neatly avoid being an incompatible
> change wrt vc-git-diff-switches being non-nil and non-t.

I've pushed it to master.

> BTW, I appreciate how you often try to improve git-related things.

Thanks!

Regards,
Rüdiger






^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-19 11:13     ` Rüdiger Sonderfeld
@ 2014-11-19 18:30       ` Glenn Morris
  2014-11-19 19:05         ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2014-11-19 18:30 UTC (permalink / raw)
  To: Rüdiger Sonderfeld; +Cc: 19099


Thanks.
FWIW, you used a non-standard markup in the ChangeLog and commit log:
"Fix bug#19099" rather than "(Bug#19099)" and "Fixes: debbugs:19099".

(Ties back in to
http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg01024.html )





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-19 18:30       ` Glenn Morris
@ 2014-11-19 19:05         ` Eli Zaretskii
  2014-11-19 19:44           ` Glenn Morris
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2014-11-19 19:05 UTC (permalink / raw)
  To: Glenn Morris; +Cc: ruediger, 19099

> From: Glenn Morris <rgm@gnu.org>
> Date: Wed, 19 Nov 2014 13:30:13 -0500
> Cc: 19099@debbugs.gnu.org
> 
> FWIW, you used a non-standard markup in the ChangeLog and commit log:
> "Fix bug#19099" rather than "(Bug#19099)" and "Fixes: debbugs:19099".

I didn't understand the "Fixes: debbugs:19099" part was a decision.
It sounded like some discussion with no conclusion.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#19099: [PATCH] vc-git: Support `diff-switches'.
  2014-11-19 19:05         ` Eli Zaretskii
@ 2014-11-19 19:44           ` Glenn Morris
  0 siblings, 0 replies; 11+ messages in thread
From: Glenn Morris @ 2014-11-19 19:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: ruediger, 19099

Eli Zaretskii wrote:

>> FWIW, you used a non-standard markup in the ChangeLog and commit log:
>> "Fix bug#19099" rather than "(Bug#19099)" and "Fixes: debbugs:19099".
>
> I didn't understand the "Fixes: debbugs:19099" part was a decision.
> It sounded like some discussion with no conclusion.

I agree with both your points.

The standard practice for ChangeLogs is not really in doubt, IMO
(modulo minor cosmetic details).

I'd really like there to be a standard for both, so I hope you push
through with that discussion and get it to a conclusion.
I don't really care what the standard is, so much as there is one.
I don't think I have the enthusiasm to help get it done right now.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-19 19:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 19:09 bug#19099: Diff options with vc-git Glenn Morris
2014-11-18 19:17 ` Eli Zaretskii
2014-11-18 19:27   ` Glenn Morris
2014-11-18 19:57     ` Eli Zaretskii
2014-11-18 20:01       ` Eli Zaretskii
2014-11-19  3:03 ` bug#19099: [PATCH] vc-git: Support `diff-switches' Rüdiger Sonderfeld
2014-11-19  4:36   ` Glenn Morris
2014-11-19 11:13     ` Rüdiger Sonderfeld
2014-11-19 18:30       ` Glenn Morris
2014-11-19 19:05         ` Eli Zaretskii
2014-11-19 19:44           ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).