/** * Clones the remote repository and then opens a connection to it. * * @throws GitAPIException * @throws IOException */ private void initClonedRepository() throws GitAPIException, IOException { if (!getUri().startsWith(FILE_URI_PREFIX)) { deleteBaseDirIfExists(); Git git = cloneToBasedir(); if (git != null) { git.close(); } git = openGitRepository(); if (git != null) { git.close(); } } }
@After public void tearDown() throws Exception { configRepo.git().close(); configRepo.getGitRepo().close(); }
try { if (git != null) { git.close();
} finally { output.close(); git.close(); if (result != null) result.getRepository().close();
/** * Close the underlying Git object. * After close, no executable call, e.g., <code>commit</code> is allowed. */ public void close() { if (jGitDelegate != null) { jGitDelegate.close(); jGitDelegate = null; } }
@Override public void reset() { try { if (git == null) { return; } git.close(); FileUtils.deleteDirectory(this.gitDir); } catch (IOException e) { log.error("not able to delete folder: " + this.gitDir, e); } }
@Override public void close() { if (mainRepository != null) { mainRepository.close(); } RepositoryCache.clear(); }
@Override public void close(Handler<Void> completionHandler) { vertx.runOnContext(v -> { if (git != null) { git.close(); } completionHandler.handle(null); }); } }
@Override public void close() { if (mainRepository != null) { mainRepository.close(); } RepositoryCache.clear(); }
public void close() { if (repo != null) { repo.close(); } if (git != null) { git.close(); } }
/** * Closes the git repository. */ @Override public void close() { if (!isUndefined()) { git.close(); } }
@Override public void close() { try { super.close(); } finally { try { getRepository().close(); } finally { lock.unlock(); } } }
@Override public void close() { try { super.close(); } finally { try { getRepository().close(); } finally { lock.unlock(); } } }
@Override public void close() throws IOException { if (clonedRepo != null) { LOG.debug("Closing local repository: " + clonedRepoPath); clonedRepo.close(); new FileUtils().deleteDir(clonedRepoPath); } }
@Override public void close() { try { super.close(); } finally { try { getRepository().close(); } finally { lock.unlock(); } } }
@Override protected void doStop() throws Exception { super.doStop(); repo.close(); git.close(); }
Git git = Git.cloneRepository().setURI( REMOTE_URL ).setDirectory( new File( "local/path/to/repo" ) ).call(); File gitDir = git.getRepository().getDirectory(); git.close(); // ... FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository repository = builder.setGitDir( gitDir ).setMustExist( true ).build();
private String currentBranch(File projectDir) { Git git = this.gitFactory.open(projectDir); try { return git.getRepository().getBranch(); } catch (IOException e) { throw new IllegalStateException(e); } finally { git.close(); } }
/** * Remove this repository. Silently fails if repo already removed. */ @Override public void remove() { try { repo.close(); super.remove(); } catch (IOException e) { // NOP } }
private boolean checkMaster() throws GitAPIException { val fr = git.fetch().setDryRun(true).call(); git.close(); return !fr.getTrackingRefUpdates().isEmpty(); }