Example usage for org.eclipse.jgit.dircache DirCacheEntry setAssumeValid

List of usage examples for org.eclipse.jgit.dircache DirCacheEntry setAssumeValid

Introduction

In this page you can find the example usage for org.eclipse.jgit.dircache DirCacheEntry setAssumeValid.

Prototype

public void setAssumeValid(boolean assume) 

Source Link

Document

Set the assume valid flag for this entry,

Usage

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

License:Open Source License

private void assumeValid(final IResource resource) throws CoreException {
    final IProject proj = resource.getProject();
    final GitProjectData pd = GitProjectData.get(proj);
    if (pd == null)
        return;//from   ww  w  .ja v a  2 s . c  o m
    final RepositoryMapping rm = pd.getRepositoryMapping(resource);
    if (rm == null)
        return;
    final Repository db = rm.getRepository();

    DirCache cache = caches.get(db);
    if (cache == null) {
        try {
            cache = db.lockDirCache();
        } catch (IOException err) {
            throw new CoreException(Activator.error(CoreText.UntrackOperation_failed, err));
        }
        caches.put(db, cache);
        mappings.put(rm, rm);
    }

    final String path = rm.getRepoRelativePath(resource);
    if (resource instanceof IContainer) {
        for (final DirCacheEntry ent : cache.getEntriesWithin(path))
            ent.setAssumeValid(assumeUnchanged);
    } else {
        final DirCacheEntry ent = cache.getEntry(path);
        if (ent != null)
            ent.setAssumeValid(assumeUnchanged);
    }
}