gitweb: Use --no-commit-id in git_commit and git_commitdiff
Use --no-commit-id option to git-diff-tree command in git_commit and git_commitdiff to filter out commit ID output that git-diff-tree adds when called with only one <tree-ish> (not only for --stdin). Remove filtering commit IDs from git-diff-tree output. This option is in git since at least v1.0.0, so make use of it. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Oct 26, 2006 at 10:50 UTC
35f401a6706238b16906666b72e207e807e71f8a
1 file changed
+4
-7
gitweb/gitweb.perl
+4
-7
@@ -3133,14 +3133,12 @@ sub git_commit {
3133
if (!defined $parent) {
3134
$parent = "--root";
3135
}
3136
- open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, $parent, $hash
3136
+ open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
3137
+ @diff_opts, $parent, $hash
3138
or die_error(undef, "Open git-diff-tree failed");
3139
my @difftree = map { chomp; $_ } <$fd>;
3140
close $fd or die_error(undef, "Reading git-diff-tree failed");
3141
3141
- # filter out commit ID output
3142
- @difftree = grep(!/^[0-9a-fA-F]{40}$/, @difftree);
3143
-
3142
# non-textual hash id's can be cached
3143
my $expires;
3144
if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
@@ -3411,15 +3409,14 @@ sub git_commitdiff {
3409
my @difftree;
3410
if ($format eq 'html') {
3411
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
3412
+ "--no-commit-id",
3413
"--patch-with-raw", "--full-index", $hash_parent, $hash
3414
or die_error(undef, "Open git-diff-tree failed");
3415
3416
while (chomp(my $line = <$fd>)) {
3417
# empty line ends raw part of diff-tree output
3418
last unless $line;
3420
- # filter out commit ID output
3421
- push @difftree, $line
3422
- unless $line =~ m/^[0-9a-fA-F]{40}$/;
3419
+ push @difftree, $line;
3420
}
3421
3422
} elsif ($format eq 'plain') {