gitweb: Simplify snapshot format detection logic in evaluate_path_info
commit095e914281395f6c0529ce39939d804eb2ccec02
authorJakub Narebski <jnareb@gmail.com>
Mon, 11 May 2009 17:42:47 +0000 (11 19:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 May 2009 17:35:39 +0000 (13 10:35 -0700)
treeb69ad8de22cdf8b81fba43a43b5a8d285fe89460
parente8bb4b38dfcbd5ff02ceb5e925d53c1460887df5
gitweb: Simplify snapshot format detection logic in evaluate_path_info

This issue was caught by perlcritic in harsh severity level noticing
that catch variable was used outside conditional thanks to the
Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest
policy.  See "Perl Best Practices", chapter 12. Regular Expressions,
section 12.15. Captured Values:

   Pattern matches that fail never assign anything to $1, $2, etc.,
   nor do they leave those variables undefined. After an unsuccessful
   pattern match, the numeric capture variables remain exactly as they
   were before the match was attempted.

New version is in my opinion much easier to understand; previous
version worked correctly due to the fact that we returned from loop
on first found match.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl