private void copyAsset( final JGitPathImpl source,
final JGitPathImpl target,
final CopyOption... options ) {
final Pair<PathType, ObjectId> sourceResult = checkPath( source.getFileSystem().gitRepo(), source.getRefTree(), source.getPath() );
final Pair<PathType, ObjectId> targetResult = checkPath( target.getFileSystem().gitRepo(), target.getRefTree(), target.getPath() );
if ( !isRoot( target ) && targetResult.getK1() != NOT_FOUND ) {
if ( !contains( options, StandardCopyOption.REPLACE_EXISTING ) ) {
throw new FileAlreadyExistsException( target.toString() );
}
}
if ( sourceResult.getK1() == NOT_FOUND ) {
throw new NoSuchFileException( target.toString() );
}
if ( sourceResult.getK1() == DIRECTORY ) {
copyDirectory( source, target, options );
return;
}
copyFile( source, target, options );
}