summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorLibravatar Jakub Narebski <jnareb@gmail.com>2006-08-24 19:39:32 +0200
committerLibravatar Junio C Hamano <junkio@cox.net>2006-08-25 19:39:55 -0700
commit3066c359c63d1dc32db5147ebf015fe9bba4c5bb (patch)
tree1daa7fecc778d62fc4a861a15c652ae947b99f47 /gitweb
parentgitweb: Add git_get_{following,preceding}_references functions (diff)
downloadtgif-3066c359c63d1dc32db5147ebf015fe9bba4c5bb.tar.xz
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>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl5
1 files changed, 2 insertions, 3 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b964302a5a..01452d2c74 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -789,16 +789,15 @@ sub git_get_preceding_references {
or return undef;
my @reflist;
- my $firstref;
foreach my $commit (@commits) {
foreach my $ref (@{$refs->{$commit}}) {
- $firstref = $ref unless $firstref;
+ return $ref unless wantarray;
push @reflist, $ref;
}
}
- return wantarray ? @reflist : $firstref;
+ return @reflist;
}
## ----------------------------------------------------------------------