]> source.dussan.org Git - jgit.git/commitdiff
Fix enum parsing from Config files 32/9632/1
authorShawn Pearce <spearce@spearce.org>
Fri, 11 Jan 2013 22:09:02 +0000 (14:09 -0800)
committerShawn Pearce <spearce@spearce.org>
Fri, 11 Jan 2013 22:09:02 +0000 (14:09 -0800)
Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141

org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

index 983603623788011277fbb67afe9eca81fa8fa1eb..72f40d7e441665036e28ea0dea99bb61b88b9273 100644 (file)
@@ -290,6 +290,9 @@ public class ConfigTest {
 
                c = parse("[s \"b\"]\n\tc = one-two\n");
                assertSame(TestEnum.ONE_TWO, c.getEnum("s", "b", "c", TestEnum.ONE_TWO));
+
+               c = parse("[s \"b\"]\n\tc = one two\n");
+               assertSame(TestEnum.ONE_TWO, c.getEnum("s", "b", "c", TestEnum.ONE_TWO));
        }
 
        @Test
index fb78d0effff910b1f2fbac350609854b1f36d126..62cfedde6684d9b0be4418d74d39063d1dc76c19 100644 (file)
@@ -387,7 +387,7 @@ public class Config {
                if (value == null)
                        return defaultValue;
 
-               String n = value.replace('-', '_');
+               String n = value.replace('-', '_').replace(' ', '_');
                T trueState = null;
                T falseState = null;
                for (T e : all) {