From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH 4/7] Normalize paths to /-format when parsing GIT URI's
Date: Thu, 8 Jan 2009 17:56:28 +0100 [thread overview]
Message-ID: <1231433791-9267-5-git-send-email-robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1231433791-9267-4-git-send-email-robin.rosenberg@dewire.com>
This means '\' on Windows will be changed to '/'.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../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
next prev parent reply other threads:[~2009-01-08 16:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-08 16:56 [EGIT PATCH 0/7] Import Wizard cleanup fixes and test Robin Rosenberg
2009-01-08 16:56 ` [EGIT PATCH 1/7] Create the import wizard question checkbox properly Robin Rosenberg
2009-01-08 16:56 ` [EGIT PATCH 2/7] Fix two strings in the cloning wizard that were not translated Robin Rosenberg
2009-01-08 16:56 ` [EGIT PATCH 3/7] Add shortcuts to the Git cloning wizard Robin Rosenberg
2009-01-08 16:56 ` Robin Rosenberg [this message]
2009-01-08 16:56 ` [EGIT PATCH 5/7] Add UNC test case to URIish test Robin Rosenberg
2009-01-08 16:56 ` [EGIT PATCH 6/7] Treat null scheme as file: in git import wizard Robin Rosenberg
2009-01-08 16:56 ` [EGIT PATCH 7/7] Create an automatic UI test for the Git Import Wizard Robin Rosenberg
2009-01-08 18:45 ` Robin Rosenberg
2009-01-08 18:57 ` Robin Rosenberg
2009-01-12 16:45 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231433791-9267-5-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).