gitweb: Faster return from git_get_preceding_references if possible
Return on first ref found when git_get_preceding_references is called in scalar context Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
470b96d483
commit
3066c359c6
|
@ -789,16 +789,15 @@ sub git_get_preceding_references {
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
my @reflist;
|
my @reflist;
|
||||||
my $firstref;
|
|
||||||
|
|
||||||
foreach my $commit (@commits) {
|
foreach my $commit (@commits) {
|
||||||
foreach my $ref (@{$refs->{$commit}}) {
|
foreach my $ref (@{$refs->{$commit}}) {
|
||||||
$firstref = $ref unless $firstref;
|
return $ref unless wantarray;
|
||||||
push @reflist, $ref;
|
push @reflist, $ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wantarray ? @reflist : $firstref;
|
return @reflist;
|
||||||
}
|
}
|
||||||
|
|
||||||
## ----------------------------------------------------------------------
|
## ----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue