Example usage for org.eclipse.jgit.lib MutableObjectId toObjectId

List of usage examples for org.eclipse.jgit.lib MutableObjectId toObjectId

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib MutableObjectId toObjectId.

Prototype

@Override
public ObjectId toObjectId() 

Source Link

Usage

From source file:org.gitective.core.filter.commit.DuplicateTreeFilter.java

License:Open Source License

public boolean include(final RevWalk walker, final RevCommit commit) throws IOException {
    final TreeWalk walk = TreeUtils.diffWithParents(walker, commit);
    final MutableObjectId id = new MutableObjectId();
    final ObjectId zero = ObjectId.zeroId();
    final DuplicateContainer dupes = new DuplicateContainer(commit);
    while (walk.next()) {
        if (!walk.isSubtree())
            continue;
        final String path = walk.getPathString();
        for (int i = 0; i < walk.getTreeCount(); i++) {
            walk.getObjectId(id, i);//from  w w  w.  j  ava2 s.  com
            if (!zero.equals(id))
                dupes.include(id.toObjectId(), path);
        }
        walk.enterSubtree();
    }
    if (dupes.validate())
        duplicates.put(commit, dupes);
    return true;
}