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

Re: Alternative approach to the git config NULL value checking patches..

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 10, 2008, 22:08 UTC
Message-ID
<alpine.LFD.1.00.0802101406560.2896@woody.linux-foundation.org>
In-Reply-To
<7vir0wfqrz.fsf@gitster.siamese.dyndns.org>
On Sun, 10 Feb 2008, Junio C Hamano wrote:
Show 7 quoted lines
> 
> I should have mentioned the reason why I did not suggest doing
> it this way in my [Janitor] message.
> 
> It is not "suttle difference between true and empty".  Empty
> means false, and with this approach, it switches the meaning of
> valueless form of config to quite the opposite.
No it does not.
Show 6 quoted lines
> will now need to be changed to:
> 
> 	if (value == config_true)
>         	Ah we have true;
> 	else if (!*value)
>         	Ok this is false;
And that was done by my patch. 
Show 6 quoted lines
> still need to be fixed to:
> 
> 	if (value == config_true)
>         	die("oops '%s' is not a bool", var);
> 	else if (!strcmp(value, "somevalue")
> 		Ok let's use somevalue;
And this is different from checking against NULL exactly how?
Show 8 quoted lines
> > This also means that code (notably the value regexp parsing) that does 
> > something like
> >
> > 	value ? value : ""
> >
> > just automatically can go away, and just use 'value' directly.
> 
> Yes, but that's broken already, isn't it?

No, it was what the regex parsing logic was - empty matches empty. Whether we really want it or not, I dunno.

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 13 in “Alternative approach to the git config NULL value checking patches..”
  1. Linus TorvaldsFeb 10, 2008
  2. Junio C HamanoFeb 10, 2008
  3. Linus TorvaldsFeb 10, 2008
  4. Junio C HamanoFeb 10, 2008
  5. Junio C HamanoFeb 10, 2008
  6. Pierre HabouzitFeb 10, 2008
  7. Linus TorvaldsFeb 10, 2008
  8. Linus TorvaldsFeb 10, 2008
  9. Linus TorvaldsFeb 10, 2008
  10. Junio C HamanoFeb 11, 2008
  11. Christian CouderFeb 11, 2008
  12. Junio C HamanoFeb 11, 2008
  13. Daniel BarkalowFeb 11, 2008

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.