Use FileUtils to handle copying of migrated repository

This commit is contained in:
Shane Kilkelly 2018-11-29 11:39:30 +00:00
parent 1a646d3fd0
commit f852cd603d

View file

@ -89,18 +89,12 @@ public class FSGitRepoStore implements RepoStore {
sourcePath,
destinationPath
);
new ProcessBuilder(
"rm", "-rf",
destinationPath
).start();
Process copyProcess = new ProcessBuilder(
"cp", "-ra",
sourcePath,
destinationPath + "/"
).start();
try {
copyProcess.waitFor();
} catch (InterruptedException e) {
File source = new File(sourcePath);
File destination = new File(destinationPath);
FileUtils.deleteDirectory(destination);
FileUtils.copyDirectory(source, destination);
} catch (Exception e) {
e.printStackTrace();
throw new IOException("copy failed" + e.getLocalizedMessage());
}