X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/e771139931847d281490f87ee18d9f5f44b4be86a6a2f3cc2ac843f918085179..40dee98b78009d8f0233ee726585b8f0350598a23aa532e09ae47b5a58a723a9:/gitweb.cgi
diff --git a/gitweb.cgi b/gitweb.cgi
index 69ae3b0..c83f539 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -17,7 +17,7 @@ use Fcntl ':mode';
binmode STDOUT, ':utf8';
my $cgi = new CGI;
-my $version = "254";
+my $version = "258";
my $my_url = $cgi->url();
my $my_uri = $cgi->url(-absolute => 1);
my $rss_link = "";
@@ -146,7 +146,7 @@ sub validate_input {
if ($input =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
return undef;
}
- if ($input =~ m/[^a-zA-Z0-9_\x80-\xff\ \.\/\-\+\#\~\%]/) {
+ if ($input =~ m/[^a-zA-Z0-9_\x80-\xff\ \t\.\/\-\+\#\~\%]/) {
return undef;
}
return $input;
@@ -311,6 +311,10 @@ a.rss_logo {
text-align:center; text-decoration:none;
}
a.rss_logo:hover { background-color:#ee5500; }
+span.tag {
+ padding:0px 4px; font-size:10px;
+ background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc;
+}
@@ -901,6 +905,20 @@ sub git_project_list {
git_footer_html();
}
+sub read_info_ref {
+ 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;
+ }
+ }
+ close $fd or return;
+ return \%refs;
+}
+
sub git_read_refs {
my $ref_dir = shift;
my @reflist;
@@ -989,6 +1007,7 @@ sub git_summary {
$owner = get_file_owner("$projectroot/$project");
}
+ my $refs = read_info_ref();
git_header_html();
print "\n" .
"summary".
@@ -1034,6 +1053,9 @@ sub git_summary {
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}";
+ }
print "\n" .
"
" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
@@ -1294,7 +1316,7 @@ sub git_get_hash_by_path {
my $t_mode = $1;
my $t_type = $2;
my $t_hash = $3;
- my $t_name = $4;
+ my $t_name = validate_input(unquote($4));
if ($t_name eq $part) {
if (!(@parts)) {
return $t_hash;
@@ -1311,7 +1333,7 @@ sub git_get_hash_by_path {
sub git_blob {
if (!defined $hash && defined $file_name) {
my $base = $hash_base || git_read_hash("$project/HEAD");
- $hash = git_get_hash_by_path($base, $file_name, "blob");
+ $hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
}
open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
git_header_html();
@@ -1426,7 +1448,6 @@ sub git_tree {
my $t_mode = $1;
my $t_type = $2;
my $t_hash = $3;
- my $t_name = $4;
my $t_name = validate_input($4);
if ($alternate) {
print " | \n";
@@ -1557,6 +1578,7 @@ sub git_log {
if (!defined $page) {
$page = 0;
}
+ my $refs = read_info_ref();
git_header_html();
print "\n";
print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -1599,13 +1621,17 @@ sub git_log {
}
for (my $i = ($page * 100); $i <= $#revlist; $i++) {
my $commit = $revlist[$i];
+ my $ref = "";
+ if (defined $refs->{$commit}) {
+ $ref = "
$refs->{$commit}";
+ }
my %co = git_read_commit($commit);
next if !%co;
my %ad = date_str($co{'author_epoch'});
print "
\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "title"},
- "$co{'age_string'}" . esc_html($co{'title'})) . "\n" .
- "
\n";
+ "
$co{'age_string'}" . esc_html($co{'title'}) . $ref) . "\n";
+ print "
\n";
print "\n" .
"
\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
@@ -1982,23 +2008,18 @@ sub git_commitdiff_plain {
# try to figure out the next tag after this commit
my $tagname;
- my %taghash;
- my $tags = git_read_refs("refs/tags");
- foreach my $entry (@$tags) {
- my %tag = %$entry;
- $taghash{$tag{'refid'}} = $tag{'name'};
- }
+ my $refs = read_info_ref();
open $fd, "-|", "$gitbin/git-rev-list HEAD";
- while (my $commit = <$fd>) {
- chomp $commit;
- if ($taghash{$commit}) {
- $tagname = $taghash{$commit};
+ chomp (my (@commits) = <$fd>);
+ close $fd;
+ foreach my $commit (@commits) {
+ if (defined $refs->{$commit}) {
+ $tagname = $refs->{$commit}
}
if ($commit eq $hash) {
last;
}
}
- close $fd;
print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
my %co = git_read_commit($hash);
@@ -2042,6 +2063,7 @@ sub git_history {
if (!%co) {
die_error(undef, "Unknown commit object.");
}
+ my $refs = read_info_ref();
git_header_html();
print "
\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -2071,6 +2093,10 @@ sub git_history {
if (!%co) {
next;
}
+ my $ref = "";
+ if (defined $refs->{$commit}) {
+ $ref = "
$refs->{$commit}";
+ }
if ($alternate) {
print "
\n";
} else {
@@ -2080,7 +2106,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)) . "") . " | \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") .
@@ -2255,6 +2281,7 @@ sub git_shortlog {
if (!defined $page) {
$page = 0;
}
+ my $refs = read_info_ref();
git_header_html();
print " \n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
@@ -2313,6 +2340,9 @@ sub git_shortlog {
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}";
+ }
print " | \n" .
"" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
|