diff options
author | Jakub Narebski <jnareb@gmail.com> | 2006-08-24 19:39:32 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-25 19:39:55 -0700 |
commit | 3066c359c63d1dc32db5147ebf015fe9bba4c5bb (patch) | |
tree | 1daa7fecc778d62fc4a861a15c652ae947b99f47 /gitweb | |
parent | gitweb: Add git_get_{following,preceding}_references functions (diff) | |
download | tgif-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-x | gitweb/gitweb.perl | 5 |
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; } ## ---------------------------------------------------------------------- |