Skip to content

Commit

Permalink
[JENKINS-16089] needs a separator here
Browse files Browse the repository at this point in the history
And since it's now a symlink that points to another symlink that then
points to the real stuff, we need recursive onion peeling.
  • Loading branch information
kohsuke committed Mar 14, 2013
1 parent b82d944 commit 4d0def4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/AbstractBuild.java
Expand Up @@ -483,7 +483,7 @@ private void createSymlink(TaskListener listener, String name, Permalink target)
if (getProject().getBuildDir().equals(new File(getProject().getRootDir(), "builds"))) {
targetDir = "builds/" + target.getId();
} else {
targetDir = getProject().getBuildDir()+target.getId();
targetDir = getProject().getBuildDir()+"/"+target.getId();
}
Util.createSymlink(getProject().getRootDir(), targetDir, name, listener);
}
Expand Down
14 changes: 11 additions & 3 deletions test/src/test/java/hudson/model/AbstractProjectTest.java
Expand Up @@ -343,17 +343,25 @@ public void testExternalBuildDirectorySymlinks() throws Exception {
FreeStyleBuild b1 = p.scheduleBuild2(0).get();
File link = new File(p.getRootDir(), "lastStable");
assertTrue(link.exists());
assertEquals(b1.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b1.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
FreeStyleBuild b2 = p.scheduleBuild2(0).get();
assertTrue(link.exists());
assertEquals(b2.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b2.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
b2.delete();
assertTrue(link.exists());
assertEquals(b1.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b1.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
b1.delete();
assertFalse(link.exists());
}

private File resolveAll(File link) throws InterruptedException, IOException {
while (true) {
File f = Util.resolveSymlinkToFile(link);
if (f==null) return link;
link = f;
}
}

@Bug(17138)
public void testExternalBuildDirectoryRenameDelete() throws Exception {
HtmlForm form = new WebClient().goTo("configure").getFormByName("config");
Expand Down

0 comments on commit 4d0def4

Please sign in to comment.