gitweb: Remove git_diff_print subroutine

Remove git_diff_print subroutine, used to print diff in previous
versions of "diff" actions, namely git_commitdiff,
git_commitdiff_plain, git_blobdiff, git_blobdiff_plain.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jakub Narebski 2006-08-25 21:15:27 +02:00 committed by Junio C Hamano
parent 9b71b1f6b3
commit 8cce8e3ddb

View file

@ -1975,77 +1975,6 @@ sub git_heads_body {
print "</table>\n";
}
## ----------------------------------------------------------------------
## functions printing large fragments, format as one of arguments
sub git_diff_print {
my $from = shift;
my $from_name = shift;
my $to = shift;
my $to_name = shift;
my $format = shift || "html";
my $from_tmp = "/dev/null";
my $to_tmp = "/dev/null";
my $pid = $$;
# create tmp from-file
if (defined $from) {
$from_tmp = "$git_temp/gitweb_" . $$ . "_from";
open my $fd2, "> $from_tmp";
open my $fd, "-|", $GIT, "cat-file", "blob", $from;
my @file = <$fd>;
print $fd2 @file;
close $fd2;
close $fd;
}
# create tmp to-file
if (defined $to) {
$to_tmp = "$git_temp/gitweb_" . $$ . "_to";
open my $fd2, "> $to_tmp";
open my $fd, "-|", $GIT, "cat-file", "blob", $to;
my @file = <$fd>;
print $fd2 @file;
close $fd2;
close $fd;
}
open my $fd, "-|", "/usr/bin/diff -u -p -L \'$from_name\' -L \'$to_name\' $from_tmp $to_tmp";
if ($format eq "plain") {
undef $/;
print <$fd>;
$/ = "\n";
} else {
while (my $line = <$fd>) {
chomp $line;
my $char = substr($line, 0, 1);
my $diff_class = "";
if ($char eq '+') {
$diff_class = " add";
} elsif ($char eq "-") {
$diff_class = " rem";
} elsif ($char eq "@") {
$diff_class = " chunk_header";
} elsif ($char eq "\\") {
# skip errors
next;
}
$line = untabify($line);
print "<div class=\"diff$diff_class\">" . esc_html($line) . "</div>\n";
}
}
close $fd;
if (defined $from) {
unlink($from_tmp);
}
if (defined $to) {
unlink($to_tmp);
}
}
## ======================================================================
## ======================================================================
## actions