]> Lady’s Gitweb - Gitweb/commit
gitweb: Refinement highlightning in combined diffs
authorMichał Kiedrowicz <redacted>
Wed, 11 Apr 2012 21:18:44 +0000 (23:18 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
commit86e3f9568b4b42c6763c5d36aa98ae2d6150c7d407fbe108e1583e8dcdc63297
tree14603e34b7c87351970f962d163c63b20338fe821a5e4cd08df371a658de2da5
parent20b7839f0cd45d4c205e8d6934370c8354078153e2b2c86430ae163434edeb61
gitweb: Refinement highlightning in combined diffs

The highlightning of combined diffs is currently disabled.  This is
because output from a combined diff is much harder to highlight because
it is not obvious which removed and added lines should be compared.

Current code requires that the number of added lines is equal to the
number of removed lines and only skips first +/- character, treating
second +/- as a line content, Thus, it is not possible to simply use
existing algorithm unchanged for combined diffs.

Let's start with a simple case: only highlight changes that come from
one parent, i.e. when every removed line has a corresponding added line
for the same parent.  This way the highlightning cannot get wrong. For
example, following diffs would be highlighted:

- removed line for first parent
+ added line for first parent
  context line
 -removed line for second parent
 +added line for second parent

or

- removed line for first parent
 -removed line for second parent
+ added line for first parent
 +added line for second parent

but following output will not:

- removed line for first parent
 -removed line for second parent
 +added line for second parent
++added line for both parents

In other words, we require that pattern of '-'-es in pre-image matches
pattern of '+'-es in post-image.

Further changes may introduce more intelligent approach that better
handles combined diffs.

Signed-off-by: Michał Kiedrowicz <redacted>
Acked-by: Jakub Narębski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.240082 seconds and 4 git commands to generate.