public Git execute() {
if (logger.isDebugEnabled()) {
logger.debug("Forking repository <{}> to <{}>",
source,
target);
}
final File origin = new File(parentFolder,
source + DOT_GIT_EXT);
final File destination = new File(parentFolder,
target + DOT_GIT_EXT);
if (destination.exists()) {
String message = String.format("Cannot fork because destination repository <%s> already exists",
target);
logger.error(message);
throw new GitException(message);
}
return Git.clone(destination,
origin.toPath().toUri().toString(),
false,
credentialsProvider,
leaders,
hookDir,
sslVerify);
}
}