From: Jakub Narebski Date: Sun, 04 Jan 2009 22:07:53 GMT Subject: Re: [PATCH] gitweb: merge boolean feature subroutines Message-ID: In-Reply-To: <20090104155858.GC4205@ftbfs.org> Matt Kraai writes: > 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