Fix human name for local .bundle files
Bug: 560903 Change-Id: I15d45330398cc573940265d16a2db29ddce085aa Signed-off-by: Konrad Windszus <konrad_w@gmx.de>
This commit is contained in:
parent
7bebce42cc
commit
54a2d48008
|
@ -953,6 +953,17 @@ public void testFileProtocol() throws IllegalArgumentException,
|
||||||
assertEquals(-1, u.getPort());
|
assertEquals(-1, u.getPort());
|
||||||
assertNull(u.getUser());
|
assertNull(u.getUser());
|
||||||
assertEquals("b.txt", u.getHumanishName());
|
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
|
@Test
|
||||||
|
|
|
@ -385,6 +385,13 @@ public final class Constants {
|
||||||
/** A bare repository typically ends with this string */
|
/** A bare repository typically ends with this string */
|
||||||
public static final String DOT_GIT_EXT = ".git";
|
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
|
* Name of the attributes file
|
||||||
*
|
*
|
||||||
|
|
|
@ -738,6 +738,11 @@ public String getHumanishName() throws IllegalArgumentException {
|
||||||
else if (result.endsWith(Constants.DOT_GIT_EXT))
|
else if (result.endsWith(Constants.DOT_GIT_EXT))
|
||||||
result = result.substring(0, result.length()
|
result = result.substring(0, result.length()
|
||||||
- Constants.DOT_GIT_EXT.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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue