Example usage for org.eclipse.jgit.revwalk RevTree has

List of usage examples for org.eclipse.jgit.revwalk RevTree has

Introduction

In this page you can find the example usage for org.eclipse.jgit.revwalk RevTree has.

Prototype

public final boolean has(RevFlag flag) 

Source Link

Document

Test to see if the flag has been set on this object.

Usage

From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java

License:Eclipse Distribution License

private void markTreeComplete(final RevTree tree) throws IOException {
    if (tree.has(COMPLETE))
        return;/*from  ww w . jav  a  2 s . c  o m*/
    tree.add(COMPLETE);
    treeWalk.reset(tree);
    while (treeWalk.next()) {
        final FileMode mode = treeWalk.getFileMode(0);
        final int sType = mode.getObjectType();

        switch (sType) {
        case Constants.OBJ_BLOB:
            treeWalk.getObjectId(idBuffer, 0);
            revWalk.lookupAny(idBuffer, sType).add(COMPLETE);
            continue;

        case Constants.OBJ_TREE: {
            treeWalk.getObjectId(idBuffer, 0);
            final RevObject o = revWalk.lookupAny(idBuffer, sType);
            if (!o.has(COMPLETE)) {
                o.add(COMPLETE);
                treeWalk.enterSubtree();
            }
            continue;
        }
        default:
            if (FileMode.GITLINK.equals(mode))
                continue;
            treeWalk.getObjectId(idBuffer, 0);
            throw new CorruptObjectException(MessageFormat.format(JGitText.get().corruptObjectInvalidMode3,
                    mode, idBuffer.name(), treeWalk.getPathString(), tree.name()));
        }
    }
}