From f2069411c9b5b5c99756cdfb2e54a61aef5c9f72 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Tue, 24 Oct 2006 13:52:46 +0200 Subject: [PATCH 1/3] gitweb: Get rid of git_print_simplified_log Replace calls to git_print_simplified_log with its expansion, i.e. with calling git_print_log with appropriate options. Remove no longer used git_print_simplified_log subroutine. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a201043dd3..5f0a134264 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1776,15 +1776,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 element sub git_print_tree_entry { my ($t, $basedir, $hash_base, $have_blame) = @_; @@ -3101,7 +3092,7 @@ sub git_log { "\n"; print "
\n"; - git_print_simplified_log($co{'comment'}); + git_print_log($co{'comment'}, -final_empty_line=> 1); print "
\n"; } git_footer_html(); @@ -3433,7 +3424,7 @@ sub git_commitdiff { git_print_authorship(\%co); print "
\n"; print "
\n"; - git_print_simplified_log($co{'comment'}, 1); # skip title + git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1); print "
\n"; # class="log" } elsif ($format eq 'plain') { From 62fae51dd57b36cfbb25c9ade539ea5a6ef5ad84 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Tue, 24 Oct 2006 13:54:49 +0200 Subject: [PATCH 2/3] gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff Filter out commit ID output that git-diff-tree adds when called with only one (not only for --stdin) in git_commit and git_commitdiff. This also works with older git versions, which doesn't have --no-commit-id option to git-diff-tree. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 5f0a134264..2bc14b2c2a 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3115,6 +3115,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}$/) { @@ -3391,7 +3394,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') { From 82560983997c961d9deafe0074b787c8484c2e1d Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Tue, 24 Oct 2006 13:55:33 +0200 Subject: [PATCH 3/3] gitweb: Print commit message without title in commitdiff only if there is any Print the rest of commit message (title, i.e. first line of commit message, is printed separately) only if there is any. In repository which uses signoffs this shouldn't happen, because commit message should consist of at least title and signoff. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 2bc14b2c2a..c82fc6268b 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3428,9 +3428,11 @@ sub git_commitdiff { git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash); git_print_authorship(\%co); print "
\n"; - print "
\n"; - git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1); - print "
\n"; # class="log" + if (@{$co{'comment'}} > 1) { + print "
\n"; + git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1); + print "
\n"; # class="log" + } } elsif ($format eq 'plain') { my $refs = git_get_references("tags");