提交 321597a6 编写于 作者: K kaxelson

HUDSON-3533: [FIXED HUDSON-3533]

Added code to remove trailing slash (/) from base path when processing svn externals. This avoids a path with a double slash (//).

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17455 71c3de6d-444a-0410-be80-ed276b4c234a
上级 58c23960
......@@ -169,14 +169,19 @@ public class SubversionEventHandlerImpl extends SVNEventAdapter {
String inPath = file.getCanonicalPath().replace(File.separatorChar, '/');
String basePath = baseDir.getCanonicalPath().replace(File.separatorChar, '/');
String commonRoot = getCommonAncestor(inPath, basePath);
String relativePath = inPath;
if (commonRoot != null) {
if (equals(inPath , commonRoot)) {
return "";
} else if (startsWith(inPath, commonRoot + "/")) {
return inPath.substring(commonRoot.length() + 1);
relativePath = inPath.substring(commonRoot.length() + 1);
}
}
if (relativePath.endsWith("/")) {
relativePath = relativePath.substring(0, relativePath.length() - 1);
}
return inPath;
return relativePath;
}
private static String getCommonAncestor(String p1, String p2) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册