mirror of
https://github.com/git/git.git
synced 2025-03-28 16:33:17 +00:00
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>
This commit is contained in:
parent
f2069411c9
commit
62fae51dd5
@ -3115,6 +3115,9 @@ sub git_commit {
|
|||||||
my @difftree = map { chomp; $_ } <$fd>;
|
my @difftree = map { chomp; $_ } <$fd>;
|
||||||
close $fd or die_error(undef, "Reading git-diff-tree failed");
|
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
|
# non-textual hash id's can be cached
|
||||||
my $expires;
|
my $expires;
|
||||||
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
|
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
|
||||||
@ -3391,7 +3394,9 @@ sub git_commitdiff {
|
|||||||
while (chomp(my $line = <$fd>)) {
|
while (chomp(my $line = <$fd>)) {
|
||||||
# empty line ends raw part of diff-tree output
|
# empty line ends raw part of diff-tree output
|
||||||
last unless $line;
|
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') {
|
} elsif ($format eq 'plain') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user