diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java index 6bf8b4c7d..d403624b7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java @@ -953,6 +953,17 @@ public class URIishTest { assertEquals(-1, u.getPort()); assertNull(u.getUser()); assertEquals("b.txt", u.getHumanishName()); + + u = new URIish("file:/a/test.bundle"); + assertEquals("file", u.getScheme()); + assertFalse(u.isRemote()); + assertNull(u.getHost()); + assertNull(u.getPass()); + assertEquals("/a/test.bundle", u.getRawPath()); + assertEquals("/a/test.bundle", u.getPath()); + assertEquals(-1, u.getPort()); + assertNull(u.getUser()); + assertEquals("test", u.getHumanishName()); } @Test diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index 459ca2f7f..92367ebd0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -385,6 +385,13 @@ public final class Constants { /** A bare repository typically ends with this string */ public static final String DOT_GIT_EXT = ".git"; + /** + * The default extension for local bundle files + * + * @since 5.8 + */ + public static final String DOT_BUNDLE_EXT = ".bundle"; + /** * Name of the attributes file * 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 06520ec4c..b9fdf0160 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -738,6 +738,11 @@ public class URIish implements Serializable { else if (result.endsWith(Constants.DOT_GIT_EXT)) result = result.substring(0, result.length() - Constants.DOT_GIT_EXT.length()); + if (("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) + && result.endsWith(Constants.DOT_BUNDLE_EXT)) { + result = result.substring(0, + result.length() - Constants.DOT_BUNDLE_EXT.length()); + } return result; }