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 73e8a041b..b90a0c467 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 @@ -726,6 +726,15 @@ public class ConfigTest { assertArrayEquals(new String[]{""}, c.getStringList("a", null, "x")); } + @Test + public void testEmptyValueAtEof() throws Exception { + String text = "[a]\nx ="; + Config c = parse(text); + assertEquals("", c.getString("a", null, "x")); + c = parse(text + "\n"); + assertEquals("", c.getString("a", null, "x")); + } + private static void assertReadLong(long exp) throws ConfigInvalidException { assertReadLong(exp, String.valueOf(exp)); } 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 fff82a32f..16953bb34 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -1200,8 +1200,6 @@ public class Config { for (;;) { int c = in.read(); if (c < 0) { - if (value.length() == 0) - throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); break; }