This means '\' on Windows will be changed to '/'. Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../tst/org/spearce/jgit/transport/URIishTest.java | 10 ++++++++++ .../src/org/spearce/jgit/transport/URIish.java | 3 ++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java index 2e5e847..8462dfc 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/URIishTest.java @@ -62,6 +62,16 @@ public void testWindowsFile() throws Exception { assertEquals(u, new URIish(str)); } + public void testWindowsFile2() throws Exception { + final String str = "D:\\m y"; + URIish u = new URIish(str); + assertNull(u.getScheme()); + assertFalse(u.isRemote()); + assertEquals("D:/m y", u.getPath()); + assertEquals("D:/m y", u.toString()); + assertEquals(u, new URIish(str)); + } + public void testFileProtoUnix() throws Exception { final String str = "file:///home/m y"; URIish u = new URIish(str); diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java b/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java index f81a709..b86e00c 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/URIish.java @@ -51,7 +51,7 @@ */ public class URIish { private static final Pattern FULL_URI = Pattern - .compile("^(?:([a-z0-9+-]+)://(?:([^/]+?)(?::([^/]+?))?@)?(?:([^/]+?))?(?::(\\d+))?)?((?:[A-Za-z]:)?/.+)$"); + .compile("^(?:([a-z][a-z0-9+-]+)://(?:([^/]+?)(?::([^/]+?))?@)?(?:([^/]+?))?(?::(\\d+))?)?((?:[A-Za-z]:)?/.+)$"); private static final Pattern SCP_URI = Pattern .compile("^(?:([^@]+?)@)?([^:]+?):(.+)$"); @@ -75,6 +75,7 @@ * @throws URISyntaxException */ public URIish(String s) throws URISyntaxException { + s = s.replace('\\', '/'); Matcher matcher = FULL_URI.matcher(s); if (matcher.matches()) { scheme = matcher.group(1); -- 1.6.1.rc3.56.gd0306 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html