]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
[Gitweb] / gitweb.perl
index edc96ecfa2c3ec18da9a359ae02f8b1d2dc7d2aadc80c12c891af13ca0744ddd..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) = @_;
@@ -3122,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();
@@ -3145,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}$/) {
@@ -3421,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') {
@@ -3454,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.220586 seconds and 4 git commands to generate.