git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Steffen Prohaska <prohaska@zib.de>
Date
Dec 15, 2007, 16:51 UTC
Message-ID
<1197737505128-git-send-email-prohaska@zib.de>

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
Next: Steffen Prohaska
Message 1 of 8 in “[RFC 1/4] Add diff-diff, which compares the diffs of two commits”
  1. Steffen ProhaskaDec 15, 2007
  2. 2/4 gitk: Add diff-diff supportSteffen Prohaska, Dec 15, 2007
  3. 3/4 gitk: Refactor getblobdiffline to split off adddifflineSteffen Prohaska, Dec 15, 2007
  4. 4/4 gitk: Use adddiffline to nicely format diff-diffSteffen Prohaska, Dec 15, 2007
  5. Johannes SchindelinDec 15, 2007
  6. Björn SteinbrinkDec 15, 2007
  7. Steffen ProhaskaDec 15, 2007
  8. Junio C HamanoDec 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.