Skip to content

Commit c20a4ef

Browse files
committed
Update additional tests (currnetly ignored) for compatibility with Git plugin 4.10.3
1 parent 0da5c5b commit c20a4ef

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStepTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ public void symlinksInNonMultibranchCannotEscapeWorkspaceContextViaReadTrusted()
322322
FileUtils.copyDirectory(new File(sampleRepo.getRoot(), ".git"), gitDirInSvnRepo);
323323
String jenkinsRootDir = r.jenkins.getRootDir().toString();
324324
// Add a Git post-checkout hook to the .git folder in the SVN repo.
325-
Files.write(gitDirInSvnRepo.toPath().resolve("hooks/post-checkout"), ("#!/bin/sh\ntouch '" + jenkinsRootDir + "/hook-executed'\n").getBytes(StandardCharsets.UTF_8));
325+
Path postCheckoutHook = gitDirInSvnRepo.toPath().resolve("hooks/post-checkout");
326+
// Always create hooks directory for compatibility with https://github.com/jenkinsci/git-plugin/pull/1207.
327+
Files.createDirectories(postCheckoutHook.getParent());
328+
Files.write(postCheckoutHook, ("#!/bin/sh\ntouch '" + jenkinsRootDir + "/hook-executed'\n").getBytes(StandardCharsets.UTF_8));
326329
sampleRepoSvn.svnkit("add", sampleRepoSvn.wc() + "/Jenkinsfile");
327330
sampleRepoSvn.svnkit("add", sampleRepoSvn.wc() + "/.git");
328331
sampleRepoSvn.svnkit("propset", "svn:executable", "ON", sampleRepoSvn.wc() + "/.git/hooks/post-checkout");
@@ -357,7 +360,10 @@ public void symlinksInNonMultibranchCannotEscapeWorkspaceContextViaReadTrusted()
357360
FileUtils.copyDirectory(new File(sampleRepo.getRoot(), ".git"), gitDirInSvnRepo);
358361
String jenkinsRootDir = r.jenkins.getRootDir().toString();
359362
// Add a Git post-checkout hook to the .git folder in the SVN repo.
360-
Files.write(gitDirInSvnRepo.toPath().resolve("hooks/post-checkout"), ("#!/bin/sh\ntouch '" + jenkinsRootDir + "/hook-executed'\n").getBytes(StandardCharsets.UTF_8));
363+
Path postCheckoutHook = gitDirInSvnRepo.toPath().resolve("hooks/post-checkout");
364+
// Always create hooks directory for compatibility with https://github.com/jenkinsci/git-plugin/pull/1207.
365+
Files.createDirectories(postCheckoutHook.getParent());
366+
Files.write(postCheckoutHook, ("#!/bin/sh\ntouch '" + jenkinsRootDir + "/hook-executed'\n").getBytes(StandardCharsets.UTF_8));
361367
sampleRepoSvn.svnkit("add", sampleRepoSvn.wc() + "/Jenkinsfile");
362368
sampleRepoSvn.svnkit("add", sampleRepoSvn.wc() + "/.git");
363369
sampleRepoSvn.svnkit("propset", "svn:executable", "ON", sampleRepoSvn.wc() + "/.git/hooks/post-checkout");

0 commit comments

Comments
 (0)