]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: We do longer need the --parents flag in rev-list.
authorRobert Fitzsimons <redacted>
Sun, 24 Dec 2006 14:31:43 +0000 (14:31 +0000)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 0f824393f7b089b5422b8071b73c630159462d73f8d25ad81152f2509402d21c..108c3ccf1d81b4b0eaa38d5d97e02b33d07862eb7cc71d1e6d83c38af41974fc 100755 (executable)
@@ -1282,13 +1282,14 @@ sub parse_commit_text {
        if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
                return;
        }
-       ($co{'id'}, my @parents) = split ' ', $header;
-       $co{'parents'} = \@parents;
-       $co{'parent'} = $parents[0];
+       $co{'id'} = $header;
+       my @parents;
        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})$/) {
+                       push @parents, $1;
                } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
                        $co{'author'} = $1;
                        $co{'author_epoch'} = $2;
@@ -1315,6 +1316,8 @@ sub parse_commit_text {
        if (!defined $co{'tree'}) {
                return;
        };
+       $co{'parents'} = \@parents;
+       $co{'parent'} = $parents[0];
 
        foreach my $title (@commit_lines) {
                $title =~ s/^    //;
@@ -1372,7 +1375,6 @@ sub parse_commit {
 
        open my $fd, "-|", git_cmd(), "rev-list",
                "--header",
-               "--parents",
                "--max-count=1",
                $commit_id,
                "--",
@@ -1415,7 +1417,6 @@ sub parse_commits {
 
        open my $fd, "-|", git_cmd(), "rev-list",
                "--header",
-               "--parents",
                ($arg ? ($arg) : ()),
                ("--max-count=" . $maxcount),
                # Add once rev-list supports the --skip option
This page took 0.255173 seconds and 4 git commands to generate.