From e925f38c2d2d38298088903419dd9dbfde2268b0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Aug 2005 20:23:35 +0200 Subject: [PATCH] v145 --- gitweb.cgi | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/gitweb.cgi b/gitweb.cgi index b6fa5ec6..a2b2e27f 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -14,7 +14,7 @@ use CGI::Carp qw(fatalsToBrowser); use Fcntl ':mode'; my $cgi = new CGI; -my $version = "143"; +my $version = "145"; my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); my $rss_link = ""; @@ -618,7 +618,7 @@ sub git_project_list { $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || ""; } print "\n" . - "" . $cgi->a({-href => "$my_uri?p=" . $proj{'path'} . ";a=summary"}, escapeHTML($proj{'path'})) . "\n" . + "" . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, escapeHTML($proj{'path'})) . "\n" . "$descr\n" . "$proj{'owner'}\n"; my $colored_age; @@ -706,7 +706,7 @@ sub git_summary { git_header_html(); print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "latest tree") . + " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree"}, "tree") . "

\n" . "
\n"; print "
project
\n"; @@ -729,7 +729,7 @@ sub git_summary { my %ad = date_str($co{'author_epoch'}); print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, - "" . $co{'age_string'} . "" . escapeHTML($co{'title'})) . "\n" . + "$co{'age_string'}" . escapeHTML($co{'title'})) . "\n" . "
\n"; if (--$i == 0) { print "
" . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "...") . "
\n"; @@ -828,7 +828,7 @@ sub git_blob { print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash_base"}, "tree"); + " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree"); if (defined $file_name) { print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base;f=$file_name"}, "history"); } @@ -867,6 +867,9 @@ sub git_tree { $hash = git_get_hash_by_path($base, $file_name, "tree"); } } + if (!defined $hash_base) { + $hash_base = git_read_hash("$project/HEAD"); + } open my $fd, "-|", "$gitbin/git-ls-tree $hash" || die_error(undef, "Open git-ls-tree failed."); my (@entries) = map { chomp; $_ } <$fd>; close $fd || die_error(undef, "Reading tree failed."); @@ -938,7 +941,7 @@ sub git_rss { "\n"; print "\n"; print "$project\n". - " " . $my_url . "/$project/log\n". + " $my_url/$project/log\n". "$project log\n". "en\n"; @@ -947,7 +950,7 @@ sub git_rss { my %ad = date_str($co{'author_epoch'}); print "\n" . "\t" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'minute'}) . " - " . escapeHTML($co{'title'}) . "\n" . - "\t " . $my_url . "?p=$project;a=commit;h=$commit\n" . + "\t $my_url?p=$project;a=commit;h=$commit\n" . "\t"; my $comment = $co{'comment'}; foreach my $line (@$comment) { @@ -985,7 +988,7 @@ sub git_log { if (!@revlist) { my %co = git_read_commit($head); - print "
Last change " . $co{'age_string'} . ".

\n"; + print "
Last change $co{'age_string'}.

\n"; } foreach my $commit (@revlist) { @@ -994,7 +997,7 @@ sub git_log { my %ad = date_str($co{'author_epoch'}); print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "title"}, - "" . $co{'age_string'} . "" . escapeHTML($co{'title'})) . "\n" . + "$co{'age_string'}" . escapeHTML($co{'title'})) . "\n" . "
\n"; print "
\n" . "
\n" . @@ -1002,13 +1005,13 @@ sub git_log { " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") . "
\n" . "
\n" . - "" . escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]
\n" . + "" . escapeHTML($co{'author_name'}) . " [$ad{'rfc2822'}]
\n" . "
\n" . "
\n"; my $comment = $co{'comment'}; my $empty = 0; foreach my $line (@$comment) { - if ($line =~ m/^(signed[ \-]off[\-]by[ :]|acked[\-]by[ \:]|cc[ :])/i) { + if ($line =~ m/^(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) { next; } if ($line eq "") { @@ -1039,7 +1042,7 @@ sub git_commit { my @difftree; if (defined $co{'parent'}) { - open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash" || die_error(undef, "Open failed."); + open my $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $hash" || die_error(undef, "Open failed."); @difftree = map { chomp; $_ } <$fd>; close $fd || die_error(undef, "Reading diff-tree failed."); } else { @@ -1055,7 +1058,7 @@ sub git_commit { if (defined $co{'parent'}) { print " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff"); } - print " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash"}, "tree") . "\n" . + print " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . "\n" . "

\n"; if (defined $co{'parent'}) { print "
\n" . @@ -1063,13 +1066,13 @@ sub git_commit { "
\n"; } else { print "
\n" . - $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . "
\n"; } print "
\n" . "\n"; print "\n". - "\n"; print "\n"; - print "\n"; + print "\n"; print "\n"; print "\n"; + $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, $co{'tree'}) . "\n"; my $parents = $co{'parents'}; foreach my $par (@$parents) { print "
author" . escapeHTML($co{'author'}) . "
" . $ad{'rfc2822'}; + "
$ad{'rfc2822'}"; if ($ad{'hour_local'} < 6) { printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}); } else { @@ -1077,10 +1080,10 @@ sub git_commit { } print "
committer" . escapeHTML($co{'committer'}) . "
" . $cd{'rfc2822'} . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "
$cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "
commit$hash
tree" . - $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=" . $hash}, $co{'tree'}) . "
parent" . @@ -1102,7 +1105,7 @@ sub git_commit { } else { $empty = 0; } - if ($line =~ m/^(signed[ \-]off[\-]by[ :]|acked[\-]by[ \:]|cc[ :])/i) { + if ($line =~ m/^(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) { $signed = 1; print "" . escapeHTML($line) . "
\n"; } else { @@ -1135,7 +1138,7 @@ sub git_commit { } print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, - escapeHTML($file) . " [new " . file_type($mode) . $mode_chng . "]") . "\n" . + escapeHTML($file) . " [new " . file_type($mode) . "$mode_chng]") . "\n" . "
\n"; print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . "\n" . @@ -1202,7 +1205,7 @@ sub git_blobdiff { $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash_base"}, "tree"); + " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree"); if (defined $file_name) { print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base;f=$file_name"}, "history"); } @@ -1238,7 +1241,7 @@ sub git_commitdiff { if (!%co) { die_error(undef, "Unknown commit object."); } - open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash" || die_error(undef, "Open failed."); + open my $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $hash" || die_error(undef, "Open failed."); my (@difftree) = map { chomp; $_ } <$fd>; close $fd || die_error(undef, "Reading diff-tree failed."); @@ -1307,7 +1310,7 @@ sub git_history { print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . " | " . - $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash"}, "tree") . + $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . "

\n" . "
\n"; print "
\n" . @@ -1335,16 +1338,16 @@ sub git_history { } print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, - "" . $co{'age_string'} . "" . escapeHTML($co{'title'})) . "\n" . + "$co{'age_string'}" . escapeHTML($co{'title'})) . "\n" . "
\n"; print "
\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$commit"}, "tree") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=" . $file}, "blob"); + " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=$file"}, "blob"); my $blob = git_get_hash_by_path($hash, $file_name); my $blob_parent = git_get_hash_by_path($commit, $file_name); if (defined $blob && defined $blob_parent && $blob ne $blob_parent) { - print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=" . $file}, "diff"); + print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file"}, "diff"); } print "
\n" . "
\n"; -- 2.11.0