From: Michal Kiedrowicz Date: Thu, 05 Apr 2012 06:25:57 GMT Subject: Re: [PATCH v3 7/8] gitweb: Highlight interesting parts of diff Message-ID: <20120405082557.7223ff6e@mkiedrowicz.ivo.pl> In-Reply-To: <1333569433-3245-8-git-send-email-michal.kiedrowicz@gmail.com> Michał Kiedrowicz wrote: > 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 > Acked-by: Jakub Narębski Junio, can you please fixup this patch? I just noticed "chomp $rem, $add" breaks the testsuite. diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index e4351fe..961fbdc 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -5067,7 +5067,8 @@ sub format_rem_add_lines_pair { # We need to untabify lines before split()'ing them; # otherwise offsets would be invalid. - chomp $rem, $add; + chomp $rem; + chomp $add; $rem = untabify($rem); $add = untabify($add);