@matheusbsbs / matheus-bagliano / commits / ccdfdea08d
Fork 0

gitweb: Re-enable rev-list --parents for parse_commit.

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>

Robert Fitzsimons committed Dec 27, 2006 at 14:22 UTC ccdfdea08db398fca1580a970c0d283affa5343f
1 file changed +5 -5
gitweb/gitweb.perl
+5 -5
@@ -1271,7 +1271,7 @@ sub parse_tag {
1271 }
1272
1273 sub parse_commit_text {
1274 - my ($commit_text) = @_;
1274 + my ($commit_text, $withparents) = @_;
1275 my @commit_lines = split '\n', $commit_text;
1276 my %co;
1277
@@ -1281,13 +1281,12 @@ sub parse_commit_text {
1281 if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
1282 return;
1283 }
1284 - $co{'id'} = $header;
1285 - my @parents;
1284 + ($co{'id'}, my @parents) = split ' ', $header;
1285 while (my $line = shift @commit_lines) {
1286 last if $line eq "\n";
1287 if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
1288 $co{'tree'} = $1;
1290 - } elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
1289 + } elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
1290 push @parents, $1;
1291 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
1292 $co{'author'} = $1;
@@ -1373,12 +1372,13 @@ sub parse_commit {
1372 local $/ = "\0";
1373
1374 open my $fd, "-|", git_cmd(), "rev-list",
1375 + "--parents",
1376 "--header",
1377 "--max-count=1",
1378 $commit_id,
1379 "--",
1380 or die_error(undef, "Open git-rev-list failed");
1381 - %co = parse_commit_text(<$fd>);
1381 + %co = parse_commit_text(<$fd>, 1);
1382 close $fd;
1383
1384 return %co;