Skip to content

Commit

Permalink
gitweb: We do longer need the --parents flag in rev-list.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Fitzsimons authored and Junio C Hamano committed Dec 25, 2006
1 parent 756bbf5 commit 208b2df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1281,13 +1281,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;
Expand All @@ -1314,6 +1315,8 @@ sub parse_commit_text {
if (!defined $co{'tree'}) {
return;
};
$co{'parents'} = \@parents;
$co{'parent'} = $parents[0];

foreach my $title (@commit_lines) {
$title =~ s/^ //;
Expand Down Expand Up @@ -1371,7 +1374,6 @@ sub parse_commit {

open my $fd, "-|", git_cmd(), "rev-list",
"--header",
"--parents",
"--max-count=1",
$commit_id,
"--",
Expand Down Expand Up @@ -1414,7 +1416,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
Expand Down

0 comments on commit 208b2df

Please sign in to comment.