git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 8, 2013, 19:41 UTC
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?
[...]
Show 11 quoted lines
> --- 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

Previous: Ted ZlatanovNext: Ted Zlatanov
Message 2 of 7 in “git-credential-netrc: fix uninitialized warning”
  1. git-credential-netrc: fix uninitialized warningTed Zlatanov, Oct 8, 2013
  2. Jonathan NiederOct 8, 2013
  3. Ted ZlatanovOct 8, 2013
  4. Stefan BellerOct 8, 2013
  5. Ted ZlatanovOct 8, 2013
  6. Jonathan NiederOct 8, 2013
  7. Ted ZlatanovOct 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.