|
|
|
[PATCH v2 5/8] gitweb: Move HTML-formatting diff line back to process_diff_line() | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
Commit 6ba1eb51b (gitweb: Add a feature to show side-by-side diff,
2011-10-31) for no special reason moved wrapping diff line in <div> out
of format_diff_line(). Bring back old behavior.
This simplifies code in git_patchset_body() and keeps formatting of a
diff line in one place.
The more long-term purpose of this patch is to move formatting diff
lines down to print_diff_chunk(), to allow processing lines without
HTML-formatting.
This is just a refactoring patch. It's not meant to change gitweb
output.
Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@xxxxxxxxx>
Acked-by: Jakub Narębski <jnareb@xxxxxxxxx>
---
gitweb/gitweb.perl | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1a2f258..aacf518 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2438,14 +2438,17 @@ sub process_diff_line {
if ($from && $to && $line =~ m/^\@{2} /) {
$line = format_unidiff_chunk_header($line, $from, $to);
- return $diff_class, $line;
-
} elsif ($from && $to && $line =~ m/^\@{3}/) {
$line = format_cc_diff_chunk_header($line, $from, $to);
- return $diff_class, $line;
-
+ } else {
+ $line = esc_html($line, -nbsp=>1);
}
- return $diff_class, esc_html($line, -nbsp=>1);
+
+ my $diff_classes = "diff";
+ $diff_classes .= " $diff_class" if ($diff_class);
+ $line = "<div class=\"$diff_classes\">$line</div>\n";
+
+ return $diff_class, $line;
}
# Generates undef or something like "_snapshot_" or "snapshot (_tbz2_ _zip_)",
@@ -5243,9 +5246,6 @@ sub git_patchset_body {
next PATCH if ($patch_line =~ m/^diff /);
my ($class, $line) = process_diff_line($patch_line, \%from, \%to);
- my $diff_classes = "diff";
- $diff_classes .= " $class" if ($class);
- $line = "<div class=\"$diff_classes\">$line</div>\n";
if ($class eq 'chunk_header') {
print_diff_chunk($diff_style, $is_combined, @chunk);
--
1.7.8.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Newbies FAQ] [Linux Kernel Development] [Free Online Dating] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Free Online Dating] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [Fedora Users] [Linux Resources]