From: Matthias Lederhofer <matled@gmx.net>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] gitweb: fix commitdiff_plain for root commits
Date: Sun, 6 Aug 2006 19:24:47 +0200 [thread overview]
Message-ID: <20060806172447.GA12085@moooo.ath.cx> (raw)
In-Reply-To: <11548799921728-git-send-email-jnareb@gmail.com>
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
See [PATCH] gitweb: fix commitdiff for root commits from Jakub:
> No checking for empty $hash_parent in git_commitdiff_plain -- we
> rely on gitweb to give correct parameters for commitdiff_plain
> action.
I think we should always check the input and prevent any warnings.
This patch is on top of Jakubs patch, mine just did the if (!($line =~
m/..)) { next; } to be consistent with the other ifs.
---
gitweb/gitweb.perl | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d9648a0..b3bfc6b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2200,6 +2200,13 @@ sub git_commitdiff {
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
+ my %co = git_read_commit($hash);
+ if (!%co) {
+ die_error(undef, "Unknown commit object");
+ }
+ if (!defined $hash_parent) {
+ $hash_parent = $co{'parent'} || '--root';
+ }
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
@@ -2221,7 +2228,6 @@ sub git_commitdiff_plain {
}
print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
- my %co = git_read_commit($hash);
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
my $comment = $co{'comment'};
print "From: $co{'author'}\n" .
--
1.4.1.gfd699
prev parent reply other threads:[~2006-08-06 17:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-06 15:55 [PATCH] gitweb: ignore lines from diff-tree which do not match the expected format Matthias Lederhofer
2006-08-06 15:59 ` [PATCH] gitweb: Skip nonmatching lines in difftree output, consistently Jakub Narebski
2006-08-06 16:01 ` Jakub Narebski
2006-08-06 17:24 ` Matthias Lederhofer [this message]
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=20060806172447.GA12085@moooo.ath.cx \
--to=matled@gmx.net \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.