Kaynağa Gözat

Accept '-' instead of space in enum config values

This is necessary because some versions of JGit containing
the flawed c98abc9c05 were
used in the wild and wrote bad configuration files. We now
must accept this value in addition to the preferred case.

Change-Id: I3ed5451735658df6381532499130e5186805024a
tags/v2.3.0.201302130906
Shawn Pearce 11 yıl önce
ebeveyn
işleme
912ef3da19

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java Dosyayı Görüntüle

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


+ 6
- 0
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java Dosyayı Görüntüle

@@ -388,6 +388,12 @@ public class Config {
return defaultValue;

String n = value.replace(' ', '_');

// Because of c98abc9c0586c73ef7df4172644b7dd21c979e9d being used in
// the real world before its breakage was fully understood, we must
// also accept '-' as though it were ' '.
n = n.replace('-', '_');

T trueState = null;
T falseState = null;
for (T e : all) {

Loading…
İptal
Kaydet