]> git.ipfire.org Git - thirdparty/git.git/commit
range-diff: add section header instead of diff header
authorThomas Gummerer <t.gummerer@gmail.com>
Thu, 11 Jul 2019 16:08:49 +0000 (17:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2019 21:29:27 +0000 (14:29 -0700)
commitb66885a30cb84fc61986bc4eea805a31fdbea79a
tree6c1194f1200b9d363752115aa6a091fdc05bbe86
parent430be36eb53b042c447201c778b5398df887022f
range-diff: add section header instead of diff header

Currently range-diff keeps the diff header of the inner diff
intact (apart from stripping lines starting with index).  This diff
header is somewhat useful, especially when files get different
names in different ranges.

However there is no real need to keep the whole diff header for that.
The main reason we currently do that is probably because it is easy to
do.

Introduce a new range diff hunk header, that's enclosed by "##",
similar to how line numbers in diff hunks are enclosed by "@@", and
give human readable information of what exactly happened to the file,
including the file name.

This improves the readability of the range-diff by giving more concise
information to the users.  For example if a file was renamed in one
iteration, but not in another, the diff of the headers would be quite
noisy.  However the diff of a single line is concise and should be
easier to understand.

Additionally, this allows us to add these range diff section headers to
the outer diffs hunk headers using a custom userdiff pattern, which
should help making the range-diff more readable.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
range-diff.c
t/t3206-range-diff.sh
t/t3206/history.export