diff options
author | Shawn Pearce <spearce@spearce.org> | 2013-01-11 14:09:02 -0800 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2013-01-11 14:09:02 -0800 |
commit | 5630686655f768a38d682df7a792d86873d7e00b (patch) | |
tree | 737bb94f096624917e5f1c2dc3cad0916dea2df6 | |
parent | 8a63474518ee316633ee764ffb4884e4b9930377 (diff) | |
download | jgit-5630686655f768a38d682df7a792d86873d7e00b.tar.gz jgit-5630686655f768a38d682df7a792d86873d7e00b.zip |
Fix enum parsing from Config files
Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java | 3 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index 9836036237..72f40d7e44 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/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"); 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 diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index fb78d0efff..62cfedde66 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -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) { |