From: Jonathan Nieder Date: Tue, 08 Oct 2013 19:41:47 GMT Subject: Re: [PATCH] git-credential-netrc: fix uninitialized warning Message-ID: <20131008194147.GF9464@google.com> In-Reply-To: <87zjqjx25g.fsf@flea.lifelogs.com> Hi, Ted Zlatanov wrote: > Simple patch to avoid unitialized warning and log what we'll do. Sign-off? [...] > --- a/contrib/credential/netrc/git-credential-netrc > +++ b/contrib/credential/netrc/git-credential-netrc > @@ -369,7 +369,10 @@ sub find_netrc_entry { > { > my $entry_text = join ', ', map { "$_=$entry->{$_}" } keys %$entry; > foreach my $check (sort keys %$query) { > - if (defined $query->{$check}) { > + if (!defined $entry->{$check}) { > + log_debug("OK: entry has no $check token, so any value satisfies check $check"); > + } > + elsif (defined $query->{$check}) { Style: elsewhere this file seems to use cuddled elses: } elsif (...) { Or more simply, would it make sense to wrap both 'defined' checks into a single "if", like so? if (defined $entry->{$check} && defined $query->{$check}) { ... } else { log_debug(...); } Thanks and hope that helps, Jonathan