summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4fac529)
raw | patch | inline | side by side (parent: 4fac529)
author | Kay Sievers <kay.sievers@suse.de> | |
Sun, 7 Aug 2005 18:27:49 +0000 (20:27 +0200) | ||
committer | Kay Sievers <kay.sievers@suse.de> | |
Sun, 7 Aug 2005 18:27:49 +0000 (20:27 +0200) |
gitweb.cgi | patch | blob | history |
diff --git a/gitweb.cgi b/gitweb.cgi
index 9a45684806e1594d07a1684574ced2a5a9fa2564..0e2a9602c44fb6afe725c99af6a86894cbe0c6d7 100755 (executable)
--- a/gitweb.cgi
+++ b/gitweb.cgi
use Fcntl ':mode';
my $cgi = new CGI;
-my $version = "227";
+my $version = "229";
my $my_url = $cgi->url();
my $my_uri = $cgi->url(-absolute => 1);
my $rss_link = "";
my $hash = $cgi->param('h');
if (defined $hash) {
- if ($hash =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
- undef $hash;
- die_error(undef, "Non-canonical hash parameter.");
- }
- if ($hash =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) {
- undef $hash;
- die_error(undef, "Invalid character in hash parameter.");
+ if (!($hash =~ m/^[0-9a-fA-F]{40}$/)) {
+ if ($hash =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
+ undef $hash;
+ die_error(undef, "Non-canonical hash parameter.");
+ }
+ if ($hash =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) {
+ undef $hash;
+ die_error(undef, "Invalid character in hash parameter.");
+ }
+ # replace branch-name with hash
+ my $branchlist = git_read_refs("refs/heads");
+ foreach my $entry (@$branchlist) {
+ my %branch = %$entry;
+ if ($branch{'name'} eq $hash) {
+ $hash = $branch{'id'};
+ last;
+ }
+ }
}
}
if ($i-- > 0) {
print "<td><i>$tag{'age'}</i></td>\n" .
"<td>" .
- $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}", -class => "list"}, "<b>" .
+ $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}", -class => "list"}, "<b>" .
escapeHTML($tag{'name'}) . "</b>") .
"</td>\n" .
"<td class=\"link\">" .
- $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}"}, $tag{'type'});
+ $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'});
if ($tag{'type'} eq "commit") {
- print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log");
+ print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortlog") .
+ " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log");
}
print "</td>\n" .
"</tr>";
$alternate ^= 1;
print "<td><i>$tag{'age'}</i></td>\n" .
"<td>" .
- $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"},
+ $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}", -class => "list"},
"<b>" . escapeHTML($tag{'name'}) . "</b>") .
"</td>\n" .
"<td class=\"link\">" .
- $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}"}, $tag{'type'});
+ $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'});
if ($tag{'type'} eq "commit") {
print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log");
+ " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log");
}
print "</td>\n" .
"</tr>";
print "<table cellspacing=\"0\">\n";
my $alternate = 0;
while (my $line = <$fd>) {
- if ($line =~ m/^([0-9a-fA-F]{40}) /){
+ if ($line =~ m/^([0-9a-fA-F]{40})/){
$commit = $1;
next;
}