[RFC 1/4] Add diff-diff, which compares the diffs of two commits

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

 



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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux