private void copyDirectory( final JGitPathImpl source, final JGitPathImpl target, final CopyOption... options ) { final List<JGitPathImpl> directories = new ArrayList<JGitPathImpl>(); for ( final Path path : newDirectoryStream( source, null ) ) { final JGitPathImpl gPath = toPathImpl( path ); final Pair<PathType, ObjectId> pathResult = checkPath( gPath.getFileSystem().gitRepo(), gPath.getRefTree(), gPath.getPath() ); if ( pathResult.getK1() == DIRECTORY ) { directories.add( gPath ); continue; } final JGitPathImpl gTarget = composePath( target, (JGitPathImpl) gPath.getFileName() ); copyFile( gPath, gTarget ); } for ( final JGitPathImpl directory : directories ) { createDirectory( composePath( target, (JGitPathImpl) directory.getFileName() ) ); } }