From 1b1433800ec2cf5961eaa5a924b2799f6b05ae10 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Aug 2005 19:59:41 +0200 Subject: [PATCH] v016 --- gitweb.pl | 60 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/gitweb.pl b/gitweb.pl index e04712537..b1a9b661f 100755 --- a/gitweb.pl +++ b/gitweb.pl @@ -2,7 +2,7 @@ # gitweb.pl - simple web interface to track changes in git repositories # -# Version 014 +# Version 016 # # (C) 2005, Kay Sievers # (C) 2005, Christian Gierke @@ -25,39 +25,40 @@ my $hash = ""; my $hash_parent = ""; my $view_back; my $myself = $cgi->url(-absolute => 1); -my $url_path = $cgi->url(-path => 1); +my $url_parm = $cgi->url(-path => 1); +$url_parm =~ s/.*$myself//; # get values from url -if ($url_path =~ m#/([^/]+)/commit/([0-9a-fA-F]+)$#) { +if ($url_parm =~ m#/([^/]+)/commit/([0-9a-fA-F]+)$#) { $project = $1; $action = "commit"; $hash = $2; -} elsif ($url_path =~ m#/([^/]+)/treediff/([0-9a-fA-F]+)$#) { +} elsif ($url_parm =~ m#/([^/]+)/treediff/([0-9a-fA-F]+)$#) { $project = $1; $action = "treediff"; $hash = $2; -} elsif ($url_path =~ m#/([^/]+)/diff/([0-9a-fA-F]+)/([0-9a-fA-F]+)$#) { +} elsif ($url_parm =~ m#/([^/]+)/diff/([0-9a-fA-F]+)/([0-9a-fA-F]+)$#) { $project = $1; $action = "diff"; $hash = $2; $hash_parent = $3; -} elsif ($url_path =~ m#/([^/]+)/blob/([0-9a-fA-F]+)$#) { +} elsif ($url_parm =~ m#/([^/]+)/blob/([0-9a-fA-F]+)$#) { $project = $1; $action = "blob"; $hash = $2; -} elsif ($url_path =~ m#/([^/]+)/tree/([0-9a-fA-F]+)$#) { +} elsif ($url_parm =~ m#/([^/]+)/tree/([0-9a-fA-F]+)$#) { $project = $1; $action = "tree"; $hash = $2; -} elsif ($url_path =~ m#/([^/]+)/log/([0-9]+)$#) { +} elsif ($url_parm =~ m#/([^/]+)/log/([0-9]+)$#) { $project = $1; $action = "log"; $view_back = $2; -} elsif ($url_path =~ m#/([^/]+)/log$#) { +} elsif ($url_parm =~ m#/([^/]+)/log$#) { $project = $1; $action = "log"; $view_back = 1; -} elsif ($url_path =~ m#/git-logo.png$#) { +} elsif ($url_parm =~ m#/git-logo.png$#) { print $cgi->header(-type => 'image/png'); print "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104\122". "\000\000\000\110\000\000\000\033\004\003\000\000\000\055\331\324". @@ -73,6 +74,10 @@ if ($url_path =~ m#/([^/]+)/commit/([0-9a-fA-F]+)$#) { "\047\101\202\100\205\301\105\211\040\160\001\000\244\075\041\305". "\022\034\232\376\000\000\000\000\111\105\116\104\256\102\140\202"; exit; +} elsif ($url_parm =~ m#/([^/]+)$#) { + $project = $1; + $action = "log"; + $view_back = 1; } # sanitize input @@ -102,6 +107,7 @@ print <===== '; + print "===== "; if ($old ne "") { print $cgi->a({-href => "$myself/$project/blob/$old"}, $old); } else { @@ -192,14 +194,14 @@ sub git_diff { } else { print $new_name; } - print ' ====='; + print " =====\n"; while (my $line = <$fd>) { my $char = substr($line,0,1); - print '
' if $char eq '+'; - print '
' if $char eq '-'; - print '
' if $char eq '@'; + print '' if $char eq '+'; + print '' if $char eq '-'; + print '' if $char eq '@'; print escapeHTML($line); - print '
' if $char eq '+' or $char eq '-' or $char eq '@'; + print '' if $char eq '+' or $char eq '-' or $char eq '@'; } close $fd; unlink("$gittmp/$new"); @@ -324,7 +326,11 @@ if ($action eq "blob") { $comment = $shortlog . "
"; while (my $line = <$fd>) { chomp($line); - $comment .= escapeHTML($line) . "
\n"; + if ($line =~ m/signed-off-by:/i) { + $comment .= '
' . escapeHTML($line) . "
\n"; + } else { + $comment .= escapeHTML($line) . "
\n"; + } } close $fd; my $age = time-$committer_time; @@ -400,7 +406,7 @@ if ($action eq "blob") { git_header(); print "
\n"; print "view " . $cgi->a({-href => "$myself/$project/treediff/$hash"}, "diff") . "


\n"; - print "$shortlog
\n"; + print "
$shortlog
\n"; print "
\n";
 	foreach my $line (@difftree) {
 		# '*100644->100644	blob	9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596	net/ipv4/route.c'
@@ -413,14 +419,14 @@ if ($action eq "blob") {
 		my $file = $5;
 		if ($type eq "blob") {
 			if ($op eq "+") {
-				print "NEW\t" . $cgi->a({-href => "$myself/$project/blob/$id"}, $file) . "\n";
+				print "added\t" . $cgi->a({-href => "$myself/$project/blob/$id"}, $file) . "\n";
 			} elsif ($op eq "-") {
-				print "DEL\t" . $cgi->a({-href => "$myself/$project/blob/$id"}, $file) . "\n";
+				print "removed\t" . $cgi->a({-href => "$myself/$project/blob/$id"}, $file) . "\n";
 			} elsif ($op eq "*") {
 				$id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
 				my $old = $1;
 				my $new = $2;
-				print "CHANGED\t" . $cgi->a({-href => "$myself/$project/diff/$old/$new"}, $file) . "\n";
+				print "changed\t" . $cgi->a({-href => "$myself/$project/diff/$old/$new"}, $file) . "\n";
 			}
 		}
 	}
@@ -456,7 +462,7 @@ if ($action eq "blob") {
 	git_header();
 	print "
\n"; print "view " . $cgi->a({-href => "$myself/$project/commit/$hash"}, "commit") . "


\n"; - print "$shortlog
\n"; + print "
$shortlog
\n"; print "
\n";
 	foreach my $line (@difftree) {
 		# '*100644->100644	blob	8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154	Makefile'
-- 
2.45.2