Skip to content

Commit

Permalink
replace rm and mv , with cp -r
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer committed Dec 8, 2024
1 parent 0005603 commit 95c15a7
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,11 @@ private void createScriptFile(String buildJobContainerId) {
private void addAndPrepareDirectoryAndReplaceContent(String containerId, Path repositoryPath, String newDirectoryName) {
copyToContainer(repositoryPath.toString(), containerId);
addDirectory(containerId, newDirectoryName, true);
removeDirectoryAndFiles(containerId, newDirectoryName);
renameDirectoryOrFile(containerId, LOCALCI_WORKING_DIRECTORY + "/" + repositoryPath.getFileName().toString(), newDirectoryName);
insertRepositoryFiles(containerId, LOCALCI_WORKING_DIRECTORY + "/" + repositoryPath.getFileName().toString(), newDirectoryName);
}

private void removeDirectoryAndFiles(String containerId, String newName) {
executeDockerCommand(containerId, null, false, false, true, "rm", "-rf", newName);
}

private void renameDirectoryOrFile(String containerId, String oldName, String newName) {
executeDockerCommand(containerId, null, false, false, true, "mv", oldName, newName);
private void insertRepositoryFiles(String containerId, String oldName, String newName) {
executeDockerCommand(containerId, null, false, false, true, "cp", "-r", oldName + (oldName.endsWith("/") ? "." : "/."), newName);
}

private void addDirectory(String containerId, String directoryName, boolean createParentsIfNecessary) {
Expand Down

0 comments on commit 95c15a7

Please sign in to comment.