X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/40dee98b78009d8f0233ee726585b8f0350598a23aa532e09ae47b5a58a723a9..7e2767105d511630178350957ecb4b54df6b902e333ad601edf90a69d139f67b:/gitweb.cgi diff --git a/gitweb.cgi b/gitweb.cgi index c83f539..8fb8391 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -17,7 +17,7 @@ use Fcntl ':mode'; binmode STDOUT, ':utf8'; my $cgi = new CGI; -my $version = "258"; +my $version = "261"; my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); my $rss_link = ""; @@ -312,7 +312,7 @@ a.rss_logo { } a.rss_logo:hover { background-color:#ee5500; } span.tag { - padding:0px 4px; font-size:10px; + padding:0px 4px; font-size:10px; font-weight:normal; background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc; } @@ -531,6 +531,7 @@ sub git_read_commit { }; foreach my $title (@commit_lines) { + $title =~ s/^ //; if ($title ne "") { $co{'title'} = chop_str($title, 80, 5); # remove leading stuff of merges to make the interesting part visible @@ -906,13 +907,19 @@ sub git_project_list { } sub read_info_ref { + my $type = shift || ""; my %refs; # 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11 # c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{} open my $fd, "$projectroot/$project/info/refs" or return; while (my $line = <$fd>) { - if ($line =~ m/^([0-9a-fA-F]{40})\t.*\/([^\^]+)/) { - $refs{$1} = $2; + chomp($line); + if ($line =~ m/^([0-9a-fA-F]{40})\t.*$type\/([^\^]+)/) { + if (defined $refs{$1}) { + $refs{$1} .= " / $2"; + } else { + $refs{$1} = $2; + } } } close $fd or return; @@ -1043,18 +1050,19 @@ sub git_summary { } $alternate ^= 1; if ($i-- > 0) { + my $ref = ""; + if (defined $refs->{$commit}) { + $ref = " " . esc_html($refs->{$commit}) . ""; + } print "$co{'age_string'}\n" . "" . esc_html(chop_str($co{'author_name'}, 10)) . "\n" . ""; if (length($co{'title_short'}) < length($co{'title'})) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"}, - "" . esc_html($co{'title_short'}) . ""); + "" . esc_html($co{'title_short'}) . "$ref"); } else { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, - "" . esc_html($co{'title'}) . ""); - } - if (defined $refs->{$commit}) { - print " $refs->{$commit}"; + "" . esc_html($co{'title'}) . "$ref"); } print "\n" . "" . @@ -1411,6 +1419,11 @@ sub git_tree { close $fd or die_error(undef, "Reading tree failed."); $/ = "\n"; + my $refs = read_info_ref(); + my $ref = ""; + if (defined $refs->{$hash_base}) { + $ref = " " . esc_html($refs->{$hash_base}) . ""; + } git_header_html(); my $base_key = ""; my $base = ""; @@ -1426,7 +1439,7 @@ sub git_tree { "

\n" . "\n"; print "
\n" . - $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" . "
\n"; } else { print "
\n"; @@ -1623,7 +1636,7 @@ sub git_log { my $commit = $revlist[$i]; my $ref = ""; if (defined $refs->{$commit}) { - $ref = " $refs->{$commit}"; + $ref = " " . esc_html($refs->{$commit}) . ""; } my %co = git_read_commit($commit); next if !%co; @@ -1689,6 +1702,11 @@ sub git_commit { if ($hash =~ m/^[0-9a-fA-F]{40}$/) { $expires = "+1d"; } + my $refs = read_info_ref(); + my $ref = ""; + if (defined $refs->{$hash}) { + $ref = " " . esc_html($refs->{$hash}) . ""; + } git_header_html(undef, $expires); print "
\n" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") . @@ -1702,7 +1720,7 @@ sub git_commit { "

\n"; if (defined $co{'parent'}) { print "
\n" . - $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" . "
\n"; } else { print "
\n" . @@ -1926,6 +1944,11 @@ sub git_commitdiff { if ($hash =~ m/^[0-9a-fA-F]{40}$/) { $expires = "+1d"; } + my $refs = read_info_ref(); + my $ref = ""; + if (defined $refs->{$hash}) { + $ref = " " . esc_html($refs->{$hash}) . ""; + } git_header_html(undef, $expires); print "
\n" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") . @@ -1937,7 +1960,7 @@ sub git_commitdiff { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" . "
\n"; print "
\n" . - $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" . "
\n"; print "
\n"; my $comment = $co{'comment'}; @@ -2008,7 +2031,7 @@ sub git_commitdiff_plain { # try to figure out the next tag after this commit my $tagname; - my $refs = read_info_ref(); + my $refs = read_info_ref("tags"); open $fd, "-|", "$gitbin/git-rev-list HEAD"; chomp (my (@commits) = <$fd>); close $fd; @@ -2035,7 +2058,7 @@ sub git_commitdiff_plain { "\n"; foreach my $line (@$comment) {; - print " $line\n"; + print "$line\n"; } print "---\n\n"; @@ -2095,7 +2118,7 @@ sub git_history { } my $ref = ""; if (defined $refs->{$commit}) { - $ref = " $refs->{$commit}"; + $ref = " " . esc_html($refs->{$commit}) . ""; } if ($alternate) { print "\n"; @@ -2106,7 +2129,7 @@ sub git_history { print "$co{'age_string_date'}\n" . "" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "\n" . "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "" . - esc_html(chop_str($co{'title'}, 50)) . "") . "$ref\n" . + esc_html(chop_str($co{'title'}, 50)) . "$ref") . "\n" . "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") . @@ -2322,6 +2345,10 @@ sub git_shortlog { my $alternate = 0; for (my $i = ($page * 100); $i <= $#revlist; $i++) { my $commit = $revlist[$i]; + my $ref = ""; + if (defined $refs->{$commit}) { + $ref = " " . esc_html($refs->{$commit}) . ""; + } my %co = git_read_commit($commit); my %ad = date_str($co{'author_epoch'}); if ($alternate) { @@ -2335,13 +2362,10 @@ sub git_shortlog { ""; if (length($co{'title_short'}) < length($co{'title'})) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"}, - "" . esc_html($co{'title_short'}) . ""); + "" . esc_html($co{'title_short'}) . "$ref"); } else { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, - "" . esc_html($co{'title_short'}) . ""); - } - if (defined $refs->{$commit}) { - print " $refs->{$commit}"; + "" . esc_html($co{'title_short'}) . "$ref"); } print "\n" . "" .