Browse Source

Fix human name for local .bundle files

Bug: 560903
Change-Id: I15d45330398cc573940265d16a2db29ddce085aa
Signed-off-by: Konrad Windszus <konrad_w@gmx.de>
stable-5.8
Konrad Windszus 5 years ago
parent
commit
54a2d48008
  1. 11
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java
  2. 7
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
  3. 5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

11
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

7
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
*

5
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;
}

Loading…
Cancel
Save