summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1613b79)
raw | patch | inline | side by side (parent: 1613b79)
author | Jakub Narebski <jnareb@gmail.com> | |
Thu, 24 Aug 2006 17:34:36 +0000 (19:34 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 26 Aug 2006 02:38:30 +0000 (19:38 -0700) |
Change output of patch(set) in git_commitdiff from slurping whole diff
in @patchset array before processing, to passing file descriptor to
git_patchset_body.
Advantages: faster, incremental output, smaller memory footprint.
Disadvantages: cannot react when there is error during closing file
descriptor.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
in @patchset array before processing, to passing file descriptor to
git_patchset_body.
Advantages: faster, incremental output, smaller memory footprint.
Disadvantages: cannot react when there is error during closing file
descriptor.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1d3d9df752c67b35d603b70d7c12c69e14f62514..08e0472c6111d6e922a3ba6fc8d611abed96ac73 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
}
sub git_patchset_body {
- my ($patchset, $difftree, $hash, $hash_parent) = @_;
+ my ($fd, $difftree, $hash, $hash_parent) = @_;
my $patch_idx = 0;
my $in_header = 0;
print "<div class=\"patchset\">\n";
- LINE: foreach my $patch_line (@$patchset) {
+ LINE:
+ while (my $patch_line @$fd>) {
+ chomp $patch_line;
if ($patch_line =~ m/^diff /) { # "git diff" header
# beginning of patch (in patchset)
# read commitdiff
my $fd;
my @difftree;
- my @patchset;
if ($format eq 'html') {
open $fd, "-|", $GIT, "diff-tree", '-r', '-M', '-C',
"--patch-with-raw", "--full-index", $hash_parent, $hash
last unless $line;
push @difftree, $line;
}
- @patchset = map { chomp; $_ } <$fd>;
- close $fd
- or die_error(undef, "Reading git-diff-tree failed");
} elsif ($format eq 'plain') {
open $fd, "-|", $GIT, "diff-tree", '-r', '-p', '-B', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");
+
} else {
die_error(undef, "Unknown commitdiff format");
}
#git_difftree_body(\@difftree, $hash, $hash_parent);
#print "<br/>\n";
- git_patchset_body(\@patchset, \@difftree, $hash, $hash_parent);
-
+ git_patchset_body($fd, \@difftree, $hash, $hash_parent);
+ close $fd;
print "</div>\n"; # class="page_body"
git_footer_html();