aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib
diff options
context:
space:
mode:
authorHugo Arès <hugo.ares@ericsson.com>2016-06-15 14:40:05 -0400
committerHugo Arès <hugo.ares@ericsson.com>2016-06-27 08:59:03 -0400
commit80cd8554435bdc311d9303677f0796554e5a2dbe (patch)
treeb512f3904ee1f283a7f2e460a8d606364b1e188a /org.eclipse.jgit.test/tst/org/eclipse/jgit/lib
parent203888f3fa2319412b47c27bb122dc7af77faedd (diff)
downloadjgit-80cd8554435bdc311d9303677f0796554e5a2dbe.tar.gz
jgit-80cd8554435bdc311d9303677f0796554e5a2dbe.zip
Config load should not fail on unsupported or nonexistent include path
1f86350 added initial support for include.path. Relative path and path with tilde are not yet supported but config load was failing if one of those 2 unsupported options was encountered. Another problem was that config load was failing if the include.path file did not exist. Change the behavior to be consistent with native git. Ignore unsupported or nonexistent include.path. Bug: 495505 Bug: 496732 Change-Id: I7285d0e7abb6389ba6983e9c46021bea4344af68 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java27
1 files changed, 24 insertions, 3 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 6d07d34d3a..c14c6d7f22 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
@@ -782,10 +782,31 @@ public class ConfigTest {
@Test
public void testIncludeValuePathNotFound() throws ConfigInvalidException {
+ // we do not expect an exception, included path not found are ignored
String notFound = "/not/found";
- expectedEx.expect(ConfigInvalidException.class);
- expectedEx.expectMessage(notFound);
- parse("[include]\npath=" + notFound + "\n");
+ Config parsed = parse("[include]\npath=" + notFound + "\n");
+ assertEquals(1, parsed.getSections().size());
+ assertEquals(notFound, parsed.getString("include", null, "path"));
+ }
+
+ @Test
+ public void testIncludeValuePathWithTilde() throws ConfigInvalidException {
+ // we do not expect an exception, included path not supported are
+ // ignored
+ String notSupported = "~/someFile";
+ Config parsed = parse("[include]\npath=" + notSupported + "\n");
+ assertEquals(1, parsed.getSections().size());
+ assertEquals(notSupported, parsed.getString("include", null, "path"));
+ }
+
+ @Test
+ public void testIncludeValuePathRelative() throws ConfigInvalidException {
+ // we do not expect an exception, included path not supported are
+ // ignored
+ String notSupported = "someRelativeFile";
+ Config parsed = parse("[include]\npath=" + notSupported + "\n");
+ assertEquals(1, parsed.getSections().size());
+ assertEquals(notSupported, parsed.getString("include", null, "path"));
}
@Test