Browse Source

Fix enum parsing from Config files

Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141
stable-2.3
Shawn Pearce 12 years ago
parent
commit
5630686655
  1. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java

@ -290,6 +290,9 @@ public class ConfigTest {
c = parse("[s \"b\"]\n\tc = one-two\n"); c = parse("[s \"b\"]\n\tc = one-two\n");
assertSame(TestEnum.ONE_TWO, c.getEnum("s", "b", "c", TestEnum.ONE_TWO)); 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 @Test

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

@ -387,7 +387,7 @@ public class Config {
if (value == null) if (value == null)
return defaultValue; return defaultValue;
String n = value.replace('-', '_'); String n = value.replace('-', '_').replace(' ', '_');
T trueState = null; T trueState = null;
T falseState = null; T falseState = null;
for (T e : all) { for (T e : all) {

Loading…
Cancel
Save