Accept "foo bar" and "foo-bar" for enums

JGit post c98abc9c0586c73ef7df4172644b7dd21c979e9d changed
setEnum behavior to store "foo-bar" in a configuration file
rather than "foo bar" or "foo_bar" the way Gerrit expects.
Replace - with _ to correctly match enum names.

Change-Id: I1de25f8c10c5f35f20f96f3b6a679e4ac790666b
This commit is contained in:
Shawn Pearce
2013-01-10 18:49:12 -08:00
parent 23e03017f9
commit edfc960938

View File

@@ -102,7 +102,7 @@ public class ConfigUtil {
final String subsection, final String setting, String valueString,
final T[] all) {
String n = valueString.replace(' ', '_');
String n = valueString.replace(' ', '_').replace('-', '_');
for (final T e : all) {
if (equalsIgnoreCase(e.name(), n)) {
return e;