Example usage for org.eclipse.jgit.lib ObjectReader OBJ_ANY

List of usage examples for org.eclipse.jgit.lib ObjectReader OBJ_ANY

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib ObjectReader OBJ_ANY.

Prototype

int OBJ_ANY

To view the source code for org.eclipse.jgit.lib ObjectReader OBJ_ANY.

Click Source Link

Document

Type hint indicating the caller doesn't know the type.

Usage

From source file:org.webcat.core.git.GitTreeEntry.java

License:Open Source License

public static GitTreeEntry fromTreeWalk(TreeWalk walk, GitRepository repository, String pathPrefix) {
    ObjectId oid = walk.getObjectId(0);/*from   www  .  j  av  a  2s  .c  o  m*/
    boolean isTree = (walk.getFileMode(0) == FileMode.TREE);
    String name = walk.getNameString();
    String path = (pathPrefix == null) ? walk.getPathString() : pathPrefix + "/" + walk.getPathString();
    long size = 0;

    if (!isTree) {
        try {
            size = walk.getObjectReader().getObjectSize(oid, ObjectReader.OBJ_ANY);
        } catch (IOException e) {
            log.warn("There was an error getting the size of the object " + oid.getName(), e);
        }
    }

    return new GitTreeEntry(repository, oid, isTree, name, path, size);
}