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>
Jakub Narebski committed
Aug 25, 2006 at 21:15 UTC
8cce8e3ddb2c2f7e0ab028012ae4dc729c8bf3f9
1 file changed
-71
gitweb/gitweb.perl
-71
@@ -1975,77 +1975,6 @@ sub git_heads_body {
1975
print "</table>\n";
1976
}
1977
1978
-## ----------------------------------------------------------------------
1979
-## functions printing large fragments, format as one of arguments
1980
-
1981
-sub git_diff_print {
1982
- my $from = shift;
1983
- my $from_name = shift;
1984
- my $to = shift;
1985
- my $to_name = shift;
1986
- my $format = shift || "html";
1987
-
1988
- my $from_tmp = "/dev/null";
1989
- my $to_tmp = "/dev/null";
1990
- my $pid = $$;
1991
-
1992
- # create tmp from-file
1993
- if (defined $from) {
1994
- $from_tmp = "$git_temp/gitweb_" . $$ . "_from";
1995
- open my $fd2, "> $from_tmp";
1996
- open my $fd, "-|", $GIT, "cat-file", "blob", $from;
1997
- my @file = <$fd>;
1998
- print $fd2 @file;
1999
- close $fd2;
2000
- close $fd;
2001
- }
2002
-
2003
- # create tmp to-file
2004
- if (defined $to) {
2005
- $to_tmp = "$git_temp/gitweb_" . $$ . "_to";
2006
- open my $fd2, "> $to_tmp";
2007
- open my $fd, "-|", $GIT, "cat-file", "blob", $to;
2008
- my @file = <$fd>;
2009
- print $fd2 @file;
2010
- close $fd2;
2011
- close $fd;
2012
- }
2013
-
2014
- open my $fd, "-|", "/usr/bin/diff -u -p -L \'$from_name\' -L \'$to_name\' $from_tmp $to_tmp";
2015
- if ($format eq "plain") {
2016
- undef $/;
2017
- print <$fd>;
2018
- $/ = "\n";
2019
- } else {
2020
- while (my $line = <$fd>) {
2021
- chomp $line;
2022
- my $char = substr($line, 0, 1);
2023
- my $diff_class = "";
2024
- if ($char eq '+') {
2025
- $diff_class = " add";
2026
- } elsif ($char eq "-") {
2027
- $diff_class = " rem";
2028
- } elsif ($char eq "@") {
2029
- $diff_class = " chunk_header";
2030
- } elsif ($char eq "\\") {
2031
- # skip errors
2032
- next;
2033
- }
2034
- $line = untabify($line);
2035
- print "<div class=\"diff$diff_class\">" . esc_html($line) . "</div>\n";
2036
- }
2037
- }
2038
- close $fd;
2039
-
2040
- if (defined $from) {
2041
- unlink($from_tmp);
2042
- }
2043
- if (defined $to) {
2044
- unlink($to_tmp);
2045
- }
2046
-}
2047
-
2048
-
1978
## ======================================================================
1979
## ======================================================================
1980
## actions