Subject: Re: [PATCH] git-credential-netrc: fix uninitialized warning

From: Jonathan Nieder <[email-masked]>
Date: Tue, 8 Oct 2013 12:41:47 -0700

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