From: Brandon Casey <casey@nrlssc.navy.mil>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Robin Rosenberg <robin.rosenberg@dewire.com>, git@vger.kernel.org
Subject: Re: [JGIT PATCH 1/2] Add support for boolean config values "yes", "no"
Date: Thu, 07 May 2009 12:56:15 -0500 [thread overview]
Message-ID: <eOxTQ_L3wmawK8rFbXMLnksiI7lh8eiyptpquFGaI28e3RO7dN9GMw@cipher.nrlssc.navy.mil> (raw)
In-Reply-To: <1241708714-20326-1-git-send-email-spearce@spearce.org>
Shawn O. Pearce wrote:
> In 8f8c6fafd92f (shipped in 1.6.3) Linus taught C Git how to read
> boolean configuration values set to "yes" as true and "no" as false.
> Add support for these values, and some test cases.
Linus added support for "on" and "off" in that commit as it appears
your commit is also doing. :)
I was about to point out that you are not ignoring case for "on", but
using equalsIgnoreCase() appears to be unnecessary since above that
you are already doing n = n.toLowerCase().
-brandon
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
> index cb287ee..e3a303f 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
> @@ -254,10 +254,19 @@ public boolean getBoolean(final String section, String subsection,
> return defaultValue;
>
> n = n.toLowerCase();
> - if (MAGIC_EMPTY_VALUE.equals(n) || "yes".equalsIgnoreCase(n) || "true".equalsIgnoreCase(n) || "1".equals(n)) {
> + if (MAGIC_EMPTY_VALUE.equals(n)
> + || "yes".equalsIgnoreCase(n)
> + || "true".equalsIgnoreCase(n)
> + || "1".equals(n)
> + || "on".equals(n)) {
> return true;
> - } else if ("no".equalsIgnoreCase(n) || "false".equalsIgnoreCase(n) || "0".equalsIgnoreCase(n)) {
> +
> + } else if ("no".equalsIgnoreCase(n)
> + || "false".equalsIgnoreCase(n)
> + || "0".equalsIgnoreCase(n)
> + || "off".equalsIgnoreCase(n)) {
> return false;
> +
> } else {
> throw new IllegalArgumentException("Invalid boolean value: "
> + section + "." + name + "=" + n);
next prev parent reply other threads:[~2009-05-07 17:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 15:05 [JGIT PATCH 1/2] Add support for boolean config values "yes", "no" Shawn O. Pearce
2009-05-07 15:05 ` [JGIT PATCH 2/2] Make Repository.isValidRefName compatible with Git 1.6.3 Shawn O. Pearce
2009-05-07 23:02 ` Robin Rosenberg
2009-05-07 23:29 ` Linus Torvalds
2009-05-08 0:32 ` Junio C Hamano
2009-05-08 0:47 ` Shawn O. Pearce
2009-05-08 7:24 ` Alex Riesen
2009-05-08 8:04 ` Johannes Schindelin
2009-05-08 8:43 ` Junio C Hamano
2009-05-08 9:54 ` Johannes Schindelin
2009-05-08 11:45 ` Alex Riesen
2009-05-08 14:34 ` Shawn O. Pearce
[not found] ` <7viqkcbenb.fsf_-_@alter.siamese.dyndns.org>
2009-05-08 0:54 ` [PATCH] Allow branch names that end with ".lock" Shawn O. Pearce
2009-05-08 0:57 ` Junio C Hamano
2009-05-08 1:01 ` Shawn O. Pearce
2009-05-08 1:25 ` Junio C Hamano
2009-05-07 17:56 ` Brandon Casey [this message]
2009-05-07 18:01 ` [JGIT PATCH v2 1/2] Add support for boolean config values "on", "off" Shawn O. Pearce
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eOxTQ_L3wmawK8rFbXMLnksiI7lh8eiyptpquFGaI28e3RO7dN9GMw@cipher.nrlssc.navy.mil \
--to=casey@nrlssc.navy.mil \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
--cc=spearce@spearce.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).