gitweb: Re-enable rev-list --parents for parse_commit.
Re-enable rev-list --parents for parse_commit which was removed in
(208b2dff95
). 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>
This commit is contained in:
parent
2ef5805504
commit
ccdfdea08d
@ -1271,7 +1271,7 @@ sub parse_tag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub parse_commit_text {
|
sub parse_commit_text {
|
||||||
my ($commit_text) = @_;
|
my ($commit_text, $withparents) = @_;
|
||||||
my @commit_lines = split '\n', $commit_text;
|
my @commit_lines = split '\n', $commit_text;
|
||||||
my %co;
|
my %co;
|
||||||
|
|
||||||
@ -1281,13 +1281,12 @@ sub parse_commit_text {
|
|||||||
if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
|
if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$co{'id'} = $header;
|
($co{'id'}, my @parents) = split ' ', $header;
|
||||||
my @parents;
|
|
||||||
while (my $line = shift @commit_lines) {
|
while (my $line = shift @commit_lines) {
|
||||||
last if $line eq "\n";
|
last if $line eq "\n";
|
||||||
if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
|
if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
|
||||||
$co{'tree'} = $1;
|
$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;
|
push @parents, $1;
|
||||||
} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
|
} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
|
||||||
$co{'author'} = $1;
|
$co{'author'} = $1;
|
||||||
@ -1373,12 +1372,13 @@ sub parse_commit {
|
|||||||
local $/ = "\0";
|
local $/ = "\0";
|
||||||
|
|
||||||
open my $fd, "-|", git_cmd(), "rev-list",
|
open my $fd, "-|", git_cmd(), "rev-list",
|
||||||
|
"--parents",
|
||||||
"--header",
|
"--header",
|
||||||
"--max-count=1",
|
"--max-count=1",
|
||||||
$commit_id,
|
$commit_id,
|
||||||
"--",
|
"--",
|
||||||
or die_error(undef, "Open git-rev-list failed");
|
or die_error(undef, "Open git-rev-list failed");
|
||||||
%co = parse_commit_text(<$fd>);
|
%co = parse_commit_text(<$fd>, 1);
|
||||||
close $fd;
|
close $fd;
|
||||||
|
|
||||||
return %co;
|
return %co;
|
||||||
|
Loading…
Reference in New Issue
Block a user