List of usage examples for org.eclipse.jgit.internal.storage.file LockFile unlock
public void unlock()
From source file:jetbrains.buildServer.buildTriggers.vcs.git.tests.MockFetcher.java
License:Apache License
public static void main(String... args) throws Exception { String repositoryPath = new File(".").getAbsolutePath(); LockFile lock = new LockFile(new File(repositoryPath, "mock"), FS.DETECTED); lock.lock();//from ww w.ja v a2s .co m try { Thread.sleep(10000); Fetcher.main(args); } finally { lock.unlock(); } }
From source file:org.craftercms.studio.impl.v1.repository.git.GitContentRepository.java
License:Open Source License
@Override public void unLockItem(String site, String path) { Repository repo = helper.getRepository(site, StringUtils.isEmpty(site) ? GitRepositories.GLOBAL : SANDBOX); synchronized (helper.getRepository(site, StringUtils.isEmpty(site) ? GitRepositories.GLOBAL : SANDBOX)) { try (TreeWalk tw = new TreeWalk(repo)) { RevTree tree = helper.getTreeForLastCommit(repo); tw.addTree(tree); // tree 0 tw.setRecursive(false);/*from w w w.j a v a2s .co m*/ tw.setFilter(PathFilter.create(path)); if (!tw.next()) { return; } File repoRoot = repo.getWorkTree(); Paths.get(repoRoot.getPath(), tw.getPathString()); File file = new File(tw.getPathString()); LockFile lock = new LockFile(file); lock.unlock(); tw.close(); } catch (IOException e) { logger.error("Error while unlocking file for site: " + site + " path: " + path, e); } } }