/** {@inheritDoc} */ @Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
/** {@inheritDoc} */ @Override protected boolean mergeImpl() throws IOException { if (implicitDirCache) { dircache = nonNullRepo().lockDirCache(); } if (!inCore) { checkoutMetadata = new HashMap<>(); } try { return mergeTrees(mergeBase(), sourceTrees[0], sourceTrees[1], false); } finally { checkoutMetadata = null; if (implicitDirCache) { dircache.unlock(); } } }
} finally { try { dc.unlock(); } finally { if (performingCheckout) {
private void checkoutIndex(ObjectId commitTree) throws IOException, GitAPIException { DirCache dc = repo.lockDirCache(); try { DirCacheCheckout checkout = new DirCacheCheckout(repo, dc, commitTree); checkout.setFailOnConflict(false); checkout.setProgressMonitor(monitor); try { checkout.checkout(); } catch (org.eclipse.jgit.errors.CheckoutConflictException cce) { throw new CheckoutConflictException(checkout.getConflicts(), cce); } } finally { dc.unlock(); } }
DirCache index = repository.lockDirCache(); try { // create treeWwalk treeWalk.addTree( new DirCacheIterator( index ) ) // iterate over treeWalk } finally { index.unlock(); }
try { if (dc != null) { dc.unlock();
private RevCommit checkoutCurrentHead() throws IOException, NoHeadException { ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (headTree == null) throw new NoHeadException( JGitText.get().cannotRebaseWithoutCurrentHead); DirCache dc = repo.lockDirCache(); try { DirCacheCheckout dco = new DirCacheCheckout(repo, dc, headTree); dco.setFailOnConflict(false); dco.setProgressMonitor(monitor); boolean needsDeleteFiles = dco.checkout(); if (needsDeleteFiles) { List<String> fileList = dco.getToBeDeleted(); for (String filePath : fileList) { File fileToDelete = new File(repo.getWorkTree(), filePath); if (repo.getFS().exists(fileToDelete)) FileUtils.delete(fileToDelete, FileUtils.RECURSIVE | FileUtils.RETRY); } } } finally { dc.unlock(); } try (RevWalk rw = new RevWalk(repo)) { RevCommit commit = rw.parseCommit(repo.resolve(Constants.HEAD)); return commit; } }
dc.unlock(); } finally { WorkingTreeModifiedEvent event = new WorkingTreeModifiedEvent(
@Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
/** {@inheritDoc} */ @Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
} finally { if (dc != null) dc.unlock();
} finally { if (dc != null) dc.unlock();
@Override protected boolean mergeImpl() throws IOException { if (implicitDirCache) dircache = getRepository().lockDirCache(); try { return mergeTrees(mergeBase(), sourceTrees[0], sourceTrees[1], false); } finally { if (implicitDirCache) dircache.unlock(); } }
private void checkoutIndex(RevCommit commit) { DirCache dc = null; try { dc = repository.lockDirCache(); DirCacheCheckout checkout = new DirCacheCheckout(repository, dc, commit.getTree()); checkout.setFailOnConflict(false); checkout.checkout(); } catch (IOException e) { throw new ScmException(e); } finally { if (dc != null) { dc.unlock(); } } }