summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-04-27 14:35:12 +0200
committerRobin Stocker <robin@nibor.org>2013-04-27 14:35:12 +0200
commit23e3fb135bc7bb3c743369f42c1f2577e37811f3 (patch)
tree02a4c5e1835cb6414a6e099d22b7d005e023ddfb /org.eclipse.jgit/src
parent37f0e324b5e82f55371ef8adc195d35f7a196c58 (diff)
downloadjgit-23e3fb135bc7bb3c743369f42c1f2577e37811f3.tar.gz
jgit-23e3fb135bc7bb3c743369f42c1f2577e37811f3.zip
URIish: Allow multiple slashes in paths
It's also allowed by C Git. Change-Id: Ie0a0d1f57d84e70fd5ef50b7844d22fea43d0e08
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index d11edfc63b..deebe669a6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -3,6 +3,7 @@
* Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Christian Halstrick <christian.halstrick@sap.com>
+ * Copyright (C) 2013, Robin Stocker <robin@nibor.org>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -111,7 +112,7 @@ public class URIish implements Serializable {
* Part of a pattern which matches a relative path. Relative paths don't
* start with slash or drive letters. Defines no capturing group.
*/
- private static final String RELATIVE_PATH_P = "(?:(?:[^\\\\/]+[\\\\/])*[^\\\\/]+[\\\\/]?)"; //$NON-NLS-1$
+ private static final String RELATIVE_PATH_P = "(?:(?:[^\\\\/]+[\\\\/]+)*[^\\\\/]+[\\\\/]*)"; //$NON-NLS-1$
/**
* Part of a pattern which matches a relative or absolute path. Defines no
@@ -698,7 +699,7 @@ public class URIish implements Serializable {
if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) //$NON-NLS-1$
elements = s.split("[\\" + File.separatorChar + "/]"); //$NON-NLS-1$ //$NON-NLS-2$
else
- elements = s.split("/"); //$NON-NLS-1$
+ elements = s.split("/+"); //$NON-NLS-1$
if (elements.length == 0)
throw new IllegalArgumentException();
String result = elements[elements.length - 1];