diff --git a/gitweb.cgi b/gitweb.cgi index 2be26bdbbe..534edeaa8f 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 = "121"; +my $version = "125"; my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); my $rss_link = ""; @@ -200,11 +200,13 @@ div.list_head { div.list a { text-decoration:none; color:#000000; } div.list a:hover { color:#880000; } div.link { - margin:0px 15px; padding:0px 6px 8px; border:solid #d9d8d1; border-width:0px 1px 1px; + margin:0px 15px; padding:4px 6px 6px; border:solid #d9d8d1; border-width:0px 1px 1px; font-family:sans-serif; font-size:10px; } td { padding:5px 15px 0px 0px; font-size:12px; } th { padding-right:10px; font-size:12px; text-align:left; } +td.link { font-family:sans-serif; font-size:10px; } +td.pre { font-family:monospace; font-size:12px; white-space:pre; padding:2px 15px 0px 0px; } span.diff_info { color:#000099; background-color:#edece6; font-style:italic; } a.rss_logo { float:right; padding:3px 0px; width:35px; line-height:10px; border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; @@ -257,6 +259,16 @@ sub die_error { exit; } +sub git_get_type { + my $hash = shift; + + open my $fd, "-|", "$gitbin/git-cat-file -t $hash" || return; + my $type = <$fd>; + close $fd; + chomp $type; + return $type; +} + sub git_read_head { my $path = shift; @@ -312,7 +324,11 @@ sub git_read_commit { $co{'parent'} = $parents[0]; my (@comment) = map { chomp; $_ } <$fd>; $co{'comment'} = \@comment; - $co{'title'} = $comment[0]; + $comment[0] =~ m/^(.{0,60}[^ ]*)/; + $co{'title'} = $1; + if ($comment[0] ne $co{'title'}) { + $co{'title'} .= " [...]"; + } close $fd || return; if (!defined $co{'tree'}) { return undef @@ -564,7 +580,7 @@ sub git_get_hash_by_path { while (my $part = shift @parts) { open my $fd, "-|", "$gitbin/git-ls-tree $tree" || die_error(undef, "Open git-ls-tree failed."); my (@entries) = map { chomp; $_ } <$fd>; - close $fd || die_error(undef, "Reading tree failed."); + close $fd || return undef; foreach my $line (@entries) { #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c' $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/; @@ -594,9 +610,9 @@ sub git_blob { my $base = $file_name || ""; git_header_html(); if (defined $hash_base && (my %co = git_read_commit($hash_base))) { - print "
\n"; + print "
" . mode_str($t_mode) . " | \n"; if ($t_type eq "blob") { - print mode_str($t_mode). " " . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key}, $t_name); - if (S_ISLNK(oct $t_mode)) { - open my $fd, "-|", "$gitbin/git-cat-file blob $t_hash"; - my $target = <$fd>; - close $fd; - print "\t -> $target"; - } - print "\n"; + print "$t_name | \n"; + print "" . + $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key}, "file") . + " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base" . $file_key}, "history") . + " | \n"; } elsif ($t_type eq "tree") { - print mode_str($t_mode). " " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, $t_name) . "\n"; + print "" . + $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, $t_name) . + " | \n"; } + print "