gitweb: Highlight interesting parts of diff
Reading diff output is sometimes very hard, even if it's colored, especially if lines differ only in few characters. This is often true when a commit fixes a typo or renames some variables or functions. This commit teaches gitweb to highlight characters that are different between old and new line with a light green/red background. This should work in the similar manner as in Trac or GitHub. The algorithm that compares lines is based on contrib/diff-highlight. Basically, it works by determining common prefix/suffix of corresponding lines and highlightning only the middle part of lines. For more information, see contrib/diff-highlight/README. Combined diffs are not supported but a following commit will change it. Since we need to pass esc_html()'ed or esc_html_hl_regions()'ed lines to format_diff_lines(), so it was taught to accept preformatted lines passed as a reference. Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Acked-by: Jakub Narębski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f4a8102650
commit
5fb6ddf67a
@ -438,6 +438,10 @@ div.diff.add {
|
||||
color: #008800;
|
||||
}
|
||||
|
||||
div.diff.add span.marked {
|
||||
background-color: #aaffaa;
|
||||
}
|
||||
|
||||
div.diff.from_file a.path,
|
||||
div.diff.from_file {
|
||||
color: #aa0000;
|
||||
@ -447,6 +451,10 @@ div.diff.rem {
|
||||
color: #cc0000;
|
||||
}
|
||||
|
||||
div.diff.rem span.marked {
|
||||
background-color: #ffaaaa;
|
||||
}
|
||||
|
||||
div.diff.chunk_header a,
|
||||
div.diff.chunk_header {
|
||||
color: #990099;
|
||||
|
Reference in New Issue
Block a user