From: Junio C Hamano Date: Wed, 07 Jul 2010 05:28:41 GMT Subject: Re: [PATCH 4/5] git-cvsserver: break the loop after successful hit Message-ID: <7vwrt7zwqe.fsf@alter.siamese.dyndns.org> In-Reply-To: Áshin László writes: > No need to check for more lines of the authentication database after found a > matching one. s/found/finding/; But I see a bigger issue here. Is it plausible that you might want to allow two entries for one user, with two different passwords, in an authdb file? The current code allows it, but if we want to disallow it, we could instead add your "last", like this, if you do not break the structure of the conditional statements in the original code. while (<$passwd>) { if (m{^\Q$user\E:(.*)}) { if (crypt($user, $password) eq $1) { $auth_ok = 1; } last; } } Or have the "last" inside the inner "if" statement to keep that logic. Either way I think the original nested "if" is much easier to read than your version.