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

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

Introduction

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

Prototype

public final void add(RevFlag flag) 

Source Link

Document

Add a flag to 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;/* w  w  w . j ava  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()));
        }
    }
}