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

Re: [PATCH] gitweb: merge boolean feature subroutines

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 4, 2009, 22:07 UTC
Message-ID
<m37i5abu8a.fsf@localhost.localdomain>
In-Reply-To
<20090104155858.GC4205@ftbfs.org>
Matt Kraai <kraai@ftbfs.org> writes:
Show 14 quoted lines
> I agree that what you suggest is better than the alternatives you
> present.  Unfortunately, none of them match the current behavior.
> Here's the current code:
> 
> 	if ($val eq 'true') {
> 		return 1;
> 	} elsif ($val eq 'false') {
> 		return 0;
> 	}
> 
> 	return $_[0];
> 
> Is there a way to use the form you suggest while falling back to the
> default if $val isn't set to 'true' or 'false'?

IIRC the return value is actually threestate: 1 for true, 0 for false, and undef for non-bool config value.

BTW. git_get_project_config currently emulates old one git-config call per configuration variable, with git-config normalizing boolean values (returning 'true' or 'false'). But it could return Perl truish or Perl falsish instead, as we now use "git config -l -z" + caching config variables, and it is Perl that does normalization of boolean values.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Matt KraaiNext: Junio C Hamano
Message 11 of 12 in “gitweb: merge boolean feature subroutines”
  1. gitweb: merge boolean feature subroutinesMatt Kraai, Jan 3, 2009
  2. gitweb: pass the key to the feature subroutinesMatt Kraai, Jan 3, 2009
  3. demerphqJan 3, 2009
  4. Matt KraaiJan 3, 2009
  5. demerphqJan 3, 2009
  6. Matt KraaiJan 3, 2009
  7. demerphqJan 3, 2009
  8. Junio C HamanoJan 4, 2009
  9. demerphqJan 4, 2009
  10. Matt KraaiJan 4, 2009
  11. Jakub NarebskiJan 4, 2009
  12. Junio C HamanoJan 4, 2009

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.