@matheusbsbs / matheus-bagliano / commits / 208b2dff95
Fork 0

gitweb: We do longer need the --parents flag in rev-list.

We only want to know the direct parents of a given commit object, these parents are available in the --header output of rev-list. If --parents is supplied with --full-history the output includes merge commits that aren't relevant. Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Robert Fitzsimons committed Dec 24, 2006 at 14:31 UTC 208b2dff95bb48682c351099023a1cbb0e1edf26
1 file changed +6 -5
gitweb/gitweb.perl
+6 -5
@@ -1281,13 +1281,14 @@ sub parse_commit_text {
1281 if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
1282 return;
1283 }
1284 - ($co{'id'}, my @parents) = split ' ', $header;
1285 - $co{'parents'} = \@parents;
1286 - $co{'parent'} = $parents[0];
1284 + $co{'id'} = $header;
1285 + my @parents;
1286 while (my $line = shift @commit_lines) {
1287 last if $line eq "\n";
1288 if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
1289 $co{'tree'} = $1;
1290 + } elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
1291 + push @parents, $1;
1292 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
1293 $co{'author'} = $1;
1294 $co{'author_epoch'} = $2;
@@ -1314,6 +1315,8 @@ sub parse_commit_text {
1315 if (!defined $co{'tree'}) {
1316 return;
1317 };
1318 + $co{'parents'} = \@parents;
1319 + $co{'parent'} = $parents[0];
1320
1321 foreach my $title (@commit_lines) {
1322 $title =~ s/^ //;
@@ -1371,7 +1374,6 @@ sub parse_commit {
1374
1375 open my $fd, "-|", git_cmd(), "rev-list",
1376 "--header",
1374 - "--parents",
1377 "--max-count=1",
1378 $commit_id,
1379 "--",
@@ -1414,7 +1416,6 @@ sub parse_commits {
1416
1417 open my $fd, "-|", git_cmd(), "rev-list",
1418 "--header",
1417 - "--parents",
1419 ($arg ? ($arg) : ()),
1420 ("--max-count=" . $maxcount),
1421 # Add once rev-list supports the --skip option