summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2006-08-24 19:39:32 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-25 19:39:55 -0700
commit3066c359c63d1dc32db5147ebf015fe9bba4c5bb (patch)
tree1daa7fecc778d62fc4a861a15c652ae947b99f47
parent470b96d4837c5b019f15c8a5b013501724236de4 (diff)
downloadgit-3066c359c63d1dc32db5147ebf015fe9bba4c5bb.tar.gz
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>
-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;
}
## ----------------------------------------------------------------------