From 5630686655f768a38d682df7a792d86873d7e00b Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 11 Jan 2013 14:09:02 -0800 Subject: [PATCH] Fix enum parsing from Config files Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141 --- org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java | 3 +++ org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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) { -- 2.39.5