summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ef5805)
raw | patch | inline | side by side (parent: 2ef5805)
author | Robert Fitzsimons <robfitz@273k.net> | |
Wed, 27 Dec 2006 14:22:21 +0000 (14:22 +0000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 27 Dec 2006 22:21:50 +0000 (14:21 -0800) |
Re-enable rev-list --parents for parse_commit which was removed in
(208b2dff95bb48682c351099023a1cbb0e1edf26). rev-list --parents is not
just used to return the parent headers in the commit object, it
includes any grafts which are vaild for the commit.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(208b2dff95bb48682c351099023a1cbb0e1edf26). rev-list --parents is not
just used to return the parent headers in the commit object, it
includes any grafts which are vaild for the commit.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
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 65fcdb0f289c21b0824546884d826b48586ca712..da12be747229a7e36148e357da9a14bbf81282f3 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
}
sub parse_commit_text {
- my ($commit_text) = @_;
+ my ($commit_text, $withparents) = @_;
my @commit_lines = split '\n', $commit_text;
my %co;
if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
return;
}
- $co{'id'} = $header;
- my @parents;
+ ($co{'id'}, my @parents) = split ' ', $header;
while (my $line = shift @commit_lines) {
last if $line eq "\n";
if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
$co{'tree'} = $1;
- } elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
+ } elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
push @parents, $1;
} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
$co{'author'} = $1;
local $/ = "\0";
open my $fd, "-|", git_cmd(), "rev-list",
+ "--parents",
"--header",
"--max-count=1",
$commit_id,
"--",
or die_error(undef, "Open git-rev-list failed");
- %co = parse_commit_text(<$fd>);
+ %co = parse_commit_text(<$fd>, 1);
close $fd;
return %co;