From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 2/3] gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
Date: Tue, 24 Oct 2006 13:54:49 +0200 [thread overview]
Message-ID: <200610241354.49396.jnareb@gmail.com> (raw)
In-Reply-To: <200610241349.54685.jnareb@gmail.com>
Filter out commit ID output that git-diff-tree adds when called with
only one <tree-ish> (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 <jnareb@gmail.com>
---
gitweb/gitweb.perl | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8ac60be..a88e0a8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3009,6 +3009,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}$/) {
@@ -3327,7 +3330,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') {
--
1.4.2.1
next prev parent reply other threads:[~2006-10-24 11:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 11:49 [PATCH 0/3] gitweb: Improvements to commitdiff oview Jakub Narebski
2006-10-24 11:52 ` [PATCH 1/3] gitweb: Get rid of git_print_simplified_log Jakub Narebski
2006-10-24 11:54 ` Jakub Narebski [this message]
2006-10-25 4:36 ` [PATCH 2/3] gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff Junio C Hamano
2006-10-25 8:03 ` Jakub Narebski
2006-10-25 12:17 ` [PATCH 4/3] gitweb: Use --no-commit-id " Jakub Narebski
2006-10-25 12:23 ` [PATCH 2/3 (amend)] " Jakub Narebski
2006-10-24 11:55 ` [PATCH 3/3] gitweb: Print commit message without title in commitdiff only if there is any Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200610241354.49396.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).