Example usage for org.eclipse.jgit.dircache DirCache clear

List of usage examples for org.eclipse.jgit.dircache DirCache clear

Introduction

In this page you can find the example usage for org.eclipse.jgit.dircache DirCache clear.

Prototype

public void clear() 

Source Link

Document

Empty this index, removing all entries.

Usage

From source file:org.eclipse.egit.core.op.ResetOperation.java

License:Open Source License

private void resetIndex() throws TeamException {
    DirCache dc = null;
    try {/*from w  w  w .j av a2 s. c o m*/
        dc = repository.lockDirCache();
        dc.clear();
        DirCacheBuilder dcb = dc.builder();
        dcb.addTree(new byte[0], 0, repository.newObjectReader(), commit.getTree());
        dcb.commit();
    } catch (IOException e) {
        throw new TeamException(CoreText.ResetOperation_readingIndex, e);
    } finally {
        if (dc != null)
            dc.unlock();
    }
}

From source file:org.jfrog.bamboo.release.scm.git.ResetCommand.java

License:Eclipse Distribution License

private void resetIndex(RevCommit commit) throws IOException {
    DirCache dc = null;
    try {//ww  w. ja  v a 2s.  c o  m
        dc = repo.lockDirCache();
        dc.clear();
        DirCacheBuilder dcb = dc.builder();
        dcb.addTree(new byte[0], 0, repo.newObjectReader(), commit.getTree());
        dcb.commit();
    } finally {
        if (dc != null) {
            dc.unlock();
        }
    }
}