Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2006-10-24 15:54:49 +0400
committerJunio C Hamano <junkio@cox.net>2006-10-25 08:23:41 +0400
commit62fae51dd57b36cfbb25c9ade539ea5a6ef5ad84 (patch)
tree9142cb9642e70f4bead8d05bda4d96a84e87a6b1 /gitweb
parentf2069411c9b5b5c99756cdfb2e54a61aef5c9f72 (diff)
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 <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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl7
1 files changed, 6 insertions, 1 deletions
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') {