using:
------------
$ git range-diff @{u} @{1} @
------------
A typical output of `git range-diff` would look like this:
------------
-: ------- > 1: 0ddba11 Prepare for the inevitable!
1: c0debee = 2: cab005e Add a helpful message at the start
2: f00dbal ! 3: decafe1 Describe a bug
@@ -1,3 +1,3 @@
Author: A U Thor <author@example.com>
-TODO: Describe a bug
+Describe a bug
@@ -324,5 +324,6
This is expected.
-+What is unexpected is that it will also crash.
++Unexpectedly, it also crashes. This is a bug, and the jury is
++still out there how to fix it best. See ticket #314 for details.
Contact
3: bedead < -: ------- TO-UNDO
------------
In this example, there are 3 old and 3 new commits, where the developer
removed the 3rd, added a new one before the first two, and modified the
commit message of the 2nd commit as well as its diff.
When the output goes to a terminal, it is color-coded by default, just
like regular `git diff`'s output. In addition, the first line (adding a
commit) is green, the last line (deleting a commit) is red, the second
line (with a perfect match) is yellow like the commit header of `git
show`'s output, and the third line colors the old commit red, the new
one green and the rest like `git show`'s commit header.
A naive color-coded diff of diffs is actually a bit hard to read,
though, as it colors the entire lines red or green. The line that added
"What is unexpected" in the old commit, for example, is completely red,
even if the intent of the old commit was to add something.
To help with that, `range` uses the `--dual-color` mode by default. In
this mode, the diff of diffs will retain the original diff colors, and
prefix the lines with -/+ markers that have their *background* red or
green, to make it more obvious that they describe how the diff itself
changed.
Algorithm
---------
The general idea is this: we generate a cost matrix between the commits
in both commit ranges, then solve the least-cost assignment.
The cost matrix is populated thusly: for each pair of commits, both
diffs are generated and the "diff of diffs" is generated, with 3 context
lines, then the number of lines in that diff is used as cost.
To avoid false positives (e.g. when a patch has been removed, and an
unrelated patch has been added between two iterations of the same patch
series), the cost matrix is extended to allow for that, by adding
fixed-cost entries for wholesale deletes/adds.