From fbb592a91ed2e2d7216d162831aeaea1ed12a6cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Aug 2005 20:12:11 +0200 Subject: [PATCH] v043 --- gitweb.pl | 143 ++++++++++++++++++++++-------------------------------- 1 file changed, 59 insertions(+), 84 deletions(-) diff --git a/gitweb.pl b/gitweb.pl index dd4f963fa..cdf0e3d75 100755 --- a/gitweb.pl +++ b/gitweb.pl @@ -2,8 +2,6 @@ # gitweb.pl - simple web interface to track changes in git repositories # -# Version 042 -# # (C) 2005, Kay Sievers # (C) 2005, Christian Gierke # @@ -16,6 +14,7 @@ use CGI::Carp qw(fatalsToBrowser); my $cgi = new CGI; +my $version = "043"; my $projectroot = "/"; my $defaultprojects = "home/kay/public_html"; my $gitbin = "/home/kay/bin/git"; @@ -49,41 +48,30 @@ print <git - $project $action EOF - print "
\n"; - print "
"; + print "
"; print "" . "\"git\""; if ($defaultprojects ne "") { @@ -99,7 +87,12 @@ EOF } sub git_footer_html { - print "
\n"; + print "
"; + print ""; + if ($project ne '') { + print "XML"; + } + print "
"; print "\n"; } @@ -275,31 +268,30 @@ if ($project eq "") { my (@path) = sort grep(!/^\./, readdir($fd)); closedir($fd); git_header_html(); - print "
\n"; + print "
\n"; print "

\n"; foreach my $line (@path) { if (-e "$projectroot/$defaultprojects/$line/.git/HEAD") { print $cgi->a({-href => "$my_uri?p=$defaultprojects/$line;a=log"}, "$defaultprojects/$line") . "
\n"; } } - print "

"; + print "
"; git_footer_html(); exit; } if ($action eq "blob") { git_header_html(); - print "

\n"; - print "
\n";
+	print "


\n"; open my $fd, "-|", "$gitbin/cat-file", "blob", $hash; my $nr; while (my $line = <$fd>) { $nr++; - printf "%3i\t%s", $nr, escapeHTML($line);; + printf "%4i\t%s", $nr, escapeHTML($line);; } close $fd; - print "
\n"; - print "
"; + print "

\n"; + print "
"; git_footer_html(); } elsif ($action eq "tree") { if ($hash eq "") { @@ -309,8 +301,8 @@ if ($action eq "blob") { my (@entries) = map { chomp; $_ } <$fd>; close $fd; git_header_html(); - print "

\n"; - print "
\n";
+	print "
\n"; + print "
\n";
 	foreach my $line (@entries) {
 		#'100644	blob	0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa	panic.c'
 		$line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
@@ -325,7 +317,7 @@ if ($action eq "blob") {
 		}
 	}
 	print "
\n"; - print "
"; + print "
"; git_footer_html(); } elsif ($action eq "log" || $action eq "rss") { open my $fd, "-|", "$gitbin/rev-list", git_head($project); @@ -334,7 +326,7 @@ if ($action eq "blob") { if ($action eq "log") { git_header_html(); - print "
\n"; + print "
\n"; print "view "; print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "last day") . " | "; print $cgi->a({-href => "$my_uri?p=$project;a=log;t=7"}, "week") . " | "; @@ -343,7 +335,6 @@ if ($action eq "blob") { print $cgi->a({-href => "$my_uri?p=$project;a=log;t=0"}, "all") . "
\n"; print "

\n"; print "
\n"; - print "\n"; } elsif ($action eq "rss") { print $cgi->header(-type => 'text/xml', -charset => 'utf-8'); print "\n". @@ -383,28 +374,22 @@ if ($action eq "blob") { if ($action eq "log") { if ($time_back > 0 && $age > $time_back*60*60*24) { if ($i == 0) { - print "\n"; - print "\n"; - print "\n"; + print "
Last change $age_string.

\n"; } last; } - print "\n"; - print "\n"; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ""; - print "\n"; + print ""; } elsif ($action eq "rss") { last if ($i >= 20); print "\n\t" . $ad{'mday-time'} . " - " . escapeHTML($co{'title'}) . "\n"; @@ -430,7 +414,6 @@ if ($action eq "blob") { } } if ($action eq "log") { - print "
Last change $age_string.
" . $age_string . "" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, $co{'title'}) . "
"; + print ""; + print "
" . $age_string . "
\n"; + print $co{'title'}; + print "
\n"; + print "
\n"; + print "
"; print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "view commit") . "
\n"; print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "view diff") . "
\n"; - print "
\n"; + print "\n"; print escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]
\n"; - print "
\n"; + print ""; + print "
\n"; my $comment = $co{'comment'}; foreach my $line (@$comment) { if ($line =~ m/^(signed-off|acked)-by:/i) { @@ -414,8 +399,7 @@ if ($action eq "blob") { } } print "

\n"; - print "
\n"; git_footer_html(); } elsif ($action eq "rss") { print ""; @@ -444,17 +427,14 @@ if ($action eq "blob") { close $fd; git_header_html(); - print "
view\n"; + print "
view\n"; print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | "; print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diff"); - print "


\n"; - print "
" . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, $co{'title'}) . "
\n"; - print "\n"; - print "\n"; - print ""; - print "\n"; - print "\n"; - print ""; - print "\n"; - print "
"; + print "

\n"; + print "$co{'title'}\n"; + print "
"; print "author    " . escapeHTML($co{'author'}) . " [" . $ad{'rfc2822'} . "]
\n"; if ($ad{'hour'} < 7 ) { print ""; } - print "localtime " . $ad{'rfc2822_local'} . "
\n"; if ($ad{'hour'} < 7 ) { print "
"; } print "committer " . escapeHTML($co{'committer'}) . " [" . $cd{'rfc2822'} . "]
\n"; print "commit    $hash
\n"; @@ -463,10 +443,8 @@ if ($action eq "blob") { foreach my $par (@$parents) { print "parent    " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$par"}, $par) . "
\n"; } - print "
\n"; + print ""; + print "
\n"; my $comment = $co{'comment'}; foreach my $line (@$comment) { if ($line =~ m/(signed-off|acked)-by:/i) { @@ -476,10 +454,6 @@ if ($action eq "blob") { } } print "

\n"; - print "
"; - print "
\n";
 	foreach my $line (@difftree) {
 		# '*100644->100644	blob	9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596	net/ipv4/route.c'
@@ -506,15 +480,15 @@ if ($action eq "blob") {
 		}
 	}
 	print "
\n"; - print "
"; + print "
"; git_footer_html(); } elsif ($action eq "blobdiff") { git_header_html(); - print "

\n"; + print "


\n"; print "
\n";
 	git_diff_html($hash_parent, $hash, $hash_parent, $hash);
 	print "
\n"; - print "
"; + print "
"; git_footer_html(); } elsif ($action eq "commitdiff") { my %co = git_commit($hash); @@ -523,11 +497,12 @@ if ($action eq "blob") { close $fd; git_header_html(); - print "
view\n"; + print "
view\n"; print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | "; print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diff"); - print "


\n"; - print "
" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, $co{'title'}) . "
\n"; + print "

\n"; + print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "log_title"}, $co{'title'}) ."\n"; + print "
\n"; print "
\n";
 	foreach my $line (@difftree) {
 		# '*100644->100644	blob	8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154	Makefile'
@@ -548,8 +523,8 @@ if ($action eq "blob") {
 			}
 		}
 	}
-	print "
\n"; - print "
"; + print "
\n"; + print "
"; git_footer_html(); } else { git_header_html(); -- 2.26.2