]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
[Gitweb] / gitweb.perl
index 99bf9301e951a3aefa337ea6927bb73ed4d404fc06b2b374c88a8e18e34de1ee..404ee6d8ab9ebde38a2e367b732e7fe8b73adeb4c31867ed868ba5056da6f0e8 100755 (executable)
@@ -1777,15 +1777,6 @@ sub git_print_log ($;%) {
        }
 }
 
-sub git_print_simplified_log {
-       my $log = shift;
-       my $remove_title = shift;
-
-       git_print_log($log,
-               -final_empty_line=> 1,
-               -remove_title => $remove_title);
-}
-
 # print tree entry (row of git_tree), but without encompassing <tr> element
 sub git_print_tree_entry {
        my ($t, $basedir, $hash_base, $have_blame) = @_;
@@ -2531,6 +2522,14 @@ sub git_summary {
        }
        print "</table>\n";
 
+       if (-s "$projectroot/$project/README.html") {
+               if (open my $fd, "$projectroot/$project/README.html") {
+                       print "<div class=\"title\">readme</div>\n";
+                       print $_ while (<$fd>);
+                       close $fd;
+               }
+       }
+
        open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
                git_get_head_hash($project)
                or die_error(undef, "Open git-rev-list failed");
@@ -3114,7 +3113,7 @@ sub git_log {
                      "</div>\n";
 
                print "<div class=\"log_body\">\n";
-               git_print_simplified_log($co{'comment'});
+               git_print_log($co{'comment'}, -final_empty_line=> 1);
                print "</div>\n";
        }
        git_footer_html();
@@ -3137,6 +3136,9 @@ sub git_commit {
        my @difftree = map { chomp; $_ } <$fd>;
        close $fd or die_error(undef, "Reading git-diff-tree failed");
 
+       # filter out commit ID output
+       @difftree = grep(!/^[0-9a-fA-F]{40}$/, @difftree);
+
        # non-textual hash id's can be cached
        my $expires;
        if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
@@ -3413,7 +3415,9 @@ sub git_commitdiff {
                while (chomp(my $line = <$fd>)) {
                        # empty line ends raw part of diff-tree output
                        last unless $line;
-                       push @difftree, $line;
+                       # filter out commit ID output
+                       push @difftree, $line
+                               unless $line =~ m/^[0-9a-fA-F]{40}$/;
                }
 
        } elsif ($format eq 'plain') {
@@ -3446,7 +3450,7 @@ sub git_commitdiff {
                git_print_authorship(\%co);
                print "<div class=\"page_body\">\n";
                print "<div class=\"log\">\n";
-               git_print_simplified_log($co{'comment'}, 1); # skip title
+               git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1);
                print "</div>\n"; # class="log"
 
        } elsif ($format eq 'plain') {
This page took 0.21333 seconds and 4 git commands to generate.