aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/patch/testError_DisconnectedHunk.patch
blob: 32359704123d1f82e1f5b54170fc5e2ed74a7c4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From: A. U. Thor

@@ -109,4 +109,11 @@ assertTrue(Arrays.equals(values.toArray(), repositoryConfig
        .getStringList("my", null, "somename")));
    checkFile(cfgFile, "[my]\n\tsomename = value1\n\tsomename = value2\n");
  }
+
+ public void test006_readCaseInsensitive() throws IOException {
+   final File path = writeTrashFile("config_001", "[Foo]\nBar\n");
+   RepositoryConfig repositoryConfig = new RepositoryConfig(null, path);
+   assertEquals(true, repositoryConfig.getBoolean("foo", null, "bar", false));
+   assertEquals("", repositoryConfig.getString("foo", null, "bar"));
+ }
 }
diff --git a/org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java b/org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
index 45c2f8a..3291bba 100644
--- a/org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
+++ b/org.eclipse.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
@@ -236,9 +236,9 @@ protected boolean getBoolean(final String section, String subsection,
      return defaultValue;
 
    n = n.toLowerCase();
-   if (MAGIC_EMPTY_VALUE.equals(n) || "yes".equals(n) || "true".equals(n) || "1".equals(n)) {
+   if (MAGIC_EMPTY_VALUE.equals(n) || "yes".equalsIgnoreCase(n) || "true".equalsIgnoreCase(n) || "1".equals(n)) {
      return true;
-   } else if ("no".equals(n) || "false".equals(n) || "0".equals(n)) {
+   } else if ("no".equalsIgnoreCase(n) || "false".equalsIgnoreCase(n) || "0".equalsIgnoreCase(n)) {
      return false;
    } else {
      throw new IllegalArgumentException("Invalid boolean value: "