From 321597a6182f6bb02937d9a8fd24c2d44ed166ea Mon Sep 17 00:00:00 2001 From: kaxelson Date: Thu, 23 Apr 2009 22:33:59 +0000 Subject: [PATCH] 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 --- .../main/java/hudson/scm/SubversionEventHandlerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/scm/SubversionEventHandlerImpl.java b/core/src/main/java/hudson/scm/SubversionEventHandlerImpl.java index bef0b65c35..307f853b0f 100644 --- a/core/src/main/java/hudson/scm/SubversionEventHandlerImpl.java +++ b/core/src/main/java/hudson/scm/SubversionEventHandlerImpl.java @@ -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); } } - return inPath; + if (relativePath.endsWith("/")) { + relativePath = relativePath.substring(0, relativePath.length() - 1); + } + return relativePath; } private static String getCommonAncestor(String p1, String p2) { -- GitLab