git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-credential-netrc: fix uninitialized warning
Date: Tue, 8 Oct 2013 12:41:47 -0700	[thread overview]
Message-ID: <20131008194147.GF9464@google.com> (raw)
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

  reply	other threads:[~2013-10-08 19:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 14:34 [PATCH] git-credential-netrc: fix uninitialized warning Ted Zlatanov
2013-10-08 19:41 ` Jonathan Nieder [this message]
2013-10-08 19:55   ` Ted Zlatanov
2013-10-08 19:58     ` Stefan Beller
2013-10-08 20:04       ` Ted Zlatanov
2013-10-08 20:02     ` Jonathan Nieder
2013-10-08 20:12       ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131008194147.GF9464@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).