git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Prohaska <prohaska@zib.de>
To: git@vger.kernel.org
Cc: Steffen Prohaska <prohaska@zib.de>
Subject: [RFC 1/4] Add diff-diff, which compares the diffs of two commits
Date: Sat, 15 Dec 2007 17:51:42 +0100	[thread overview]
Message-ID: <1197737505128-git-send-email-prohaska@zib.de> (raw)

The following patch series adds experimental diff-diff support.
It adds a very basic command line version and experimental gitk
support for displaying the differences between the patches
associated with two commits.

"git diff-diff commit1 commit2" displays the differences between
the changes introduced by commit1 and commit2.  This is displayed
as a unified diff between the two patches.

In gitk you can select one commit, right click on a second
commit, and select "Diff Diff selected -> this" to display the
changes between the patches for the two commits.  Highlighting
of the result could certainly be improved.  But it is already
kind of helpful.

This can, for example, be used to compare a first version of a
patch with an improved version of the same patch.  In this case
it is helpful to display the difference between the patches (not
the files changed).  If you commented on the first version, you
may just want to check if the original author improved the patch
according to your comments.

At this point, I'm only seeking comments about the general direction.
The patches should not be applied to git.git.

 - Do you think something like this would be helpful?
 - Are similar approaches already available?
 - How do you use git to support code review; besides discussing
   patches on mailing lists?

    Steffen

---
 Makefile         |    3 ++-
 git-diff-diff.sh |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
 create mode 100755 git-diff-diff.sh

diff --git a/Makefile b/Makefile
index b9fe40b..2e015ad 100644
--- a/Makefile
+++ b/Makefile
@@ -227,7 +227,8 @@ SCRIPT_SH = \
 	git-lost-found.sh git-quiltimport.sh git-submodule.sh \
 	git-filter-branch.sh \
 	git-stash.sh \
-	git-browse--help.sh
+	git-browse--help.sh \
+	git-diff-diff.sh
 
 SCRIPT_PERL = \
 	git-add--interactive.perl \
diff --git a/git-diff-diff.sh b/git-diff-diff.sh
new file mode 100755
index 0000000..aa402b2
--- /dev/null
+++ b/git-diff-diff.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+OPTIONS_KEEPDASHDASH=
+OPTIONS_SPEC="\
+git-diff-diff <commit> <commit>
+--
+"
+
+. git-sh-setup
+require_work_tree
+
+[ $# = 3 ] || usage
+
+from=$(git rev-parse --verify $2) || exit
+to=$(git rev-parse --verify $3) || exit
+
+git show $from >.git-commit-$from
+git show $to >.git-commit-$to
+
+diff -u .git-commit-$from .git-commit-$to
+
+rm .git-commit-$from .git-commit-$to
-- 
1.5.4.rc0.37.geff3a-dirty

             reply	other threads:[~2007-12-15 16:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-15 16:51 Steffen Prohaska [this message]
2007-12-15 16:51 ` [RFC 2/4] gitk: Add diff-diff support Steffen Prohaska
2007-12-15 16:51   ` [RFC 3/4] gitk: Refactor getblobdiffline to split off adddiffline Steffen Prohaska
2007-12-15 16:51     ` [RFC 4/4] gitk: Use adddiffline to nicely format diff-diff Steffen Prohaska
2007-12-15 16:55 ` [RFC 1/4] Add diff-diff, which compares the diffs of two commits Johannes Schindelin
2007-12-15 17:04 ` Björn Steinbrink
2007-12-15 17:33   ` Steffen Prohaska
2007-12-15 19:34 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1197737505128-git-send-email-prohaska@zib.de \
    --to=prohaska@zib.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).