X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/843d673e78ebc060e97206120f560e465507b6cd7cebad7767d64abb7b3ae9c1..3db437d9dc5c685196803352761a7d113bc8f122b8609f9bd7162a5f57e7ac24:/gitweb.cgi diff --git a/gitweb.cgi b/gitweb.cgi index 6c53104..11a30eb 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -15,7 +15,7 @@ use CGI::Carp qw(fatalsToBrowser); use Fcntl ':mode'; my $cgi = new CGI; -my $version = "242"; +my $version = "243"; my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); my $rss_link = ""; @@ -478,7 +478,16 @@ sub git_read_commit { if (!defined $co{'tree'}) { return undef }; - $co{'id'} = $commit_id; + if (!($commit_id =~ m/^[0-9a-fA-F]{40}$/)) { + # lookup hash by textual id + open my $fd, "-|", "$gitbin/git-rev-parse --verify $commit_id" or return; + my $hash_id = <$fd>; + close $fd or return; + chomp $hash_id; + $co{'id'} = $hash_id + } else { + $co{'id'} = $commit_id; + } $co{'parents'} = \@parents; $co{'parent'} = $parents[0]; $co{'comment'} = \@commit_lines; @@ -1630,7 +1639,7 @@ sub git_commit { "\n"; print "committer" . escapeHTML($co{'committer'}) . "\n"; print " $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "\n"; - print "commit$hash\n"; + print "commit$co{'id'}\n"; print "" . "tree" . "" .