use of jenkins.plugins.git.GitSCMFileSystem in project blueocean-plugin by jenkinsci.
the class GitCacheCloneReadSaveRequest method invokeOnScm.
<T> T invokeOnScm(final GitSCMFileSystem.FSFunction<T> function) throws IOException {
try {
GitSCMFileSystem fs = getFilesystem();
if (fs == null) {
// Fall back to a git clone if we can't get the repository filesystem
GitCloneReadSaveRequest gitClone = new GitCloneReadSaveRequest(gitSource, branch, commitMessage, sourceBranch, filePath, contents);
GitClient git = gitClone.cloneRepo();
try {
return git.withRepository(new RepositoryCallbackToFSFunctionAdapter<>(function));
} finally {
gitClone.cleanupRepo();
}
}
return fs.invoke(function);
} catch (InterruptedException ex) {
throw new ServiceException.UnexpectedErrorException("Unable to save " + filePath, ex);
}
}
Aggregations