Example usage for org.eclipse.jgit.lib Constants OBJ_OFS_DELTA

List of usage examples for org.eclipse.jgit.lib Constants OBJ_OFS_DELTA

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Constants OBJ_OFS_DELTA.

Prototype

int OBJ_OFS_DELTA

To view the source code for org.eclipse.jgit.lib Constants OBJ_OFS_DELTA.

Click Source Link

Document

In-pack object type: offset delta

Objects stored with this type actually have a different type which must be obtained from their delta base object.

Usage

From source file:net.erdfelt.android.sdkfido.git.internal.GitInfo.java

License:Apache License

public static String asObjectType(int objectType) {
    switch (objectType) {
    case Constants.OBJ_BAD:
        return "BAD";
    case Constants.OBJ_BLOB:
        return "BLOB";
    case Constants.OBJ_COMMIT:
        return "COMMIT";
    case Constants.OBJ_EXT:
        return "EXT(future)";
    case Constants.OBJ_OFS_DELTA:
        return "OFS_DELTA(offset_delta)";
    case Constants.OBJ_REF_DELTA:
        return "REF_DELTA(reference_delta)";
    case Constants.OBJ_TAG:
        return "TAG";
    case Constants.OBJ_TREE:
        return "TREE";
    case Constants.OBJ_TYPE_5:
        return "TYPE_S(future)";
    default://from ww w  . ja va  2  s.c  om
        return "[" + objectType + "]";
    }
}

From source file:net.erdfelt.android.sdkfido.git.internal.GitInfo.java

License:Apache License

public static String getObjectName(Repository repo, ObjectId objectId) {
    try {//from ww w  . ja  v  a  2 s . co m
        ObjectLoader loader = repo.open(objectId);
        StringBuilder ret = new StringBuilder();

        if (loader.isLarge()) {
            ret.append("LARGE! ");
        }

        switch (loader.getType()) {
        case Constants.OBJ_BAD:
            ret.append("BAD ");
            break;
        case Constants.OBJ_BLOB:
            ret.append("BLOB ");
            break;
        case Constants.OBJ_COMMIT:
            ret.append("COMMIT ");
            break;
        case Constants.OBJ_EXT:
            ret.append("EXT ");
            break;
        case Constants.OBJ_OFS_DELTA:
            ret.append("OFS_DELTA ");
            break;
        case Constants.OBJ_REF_DELTA:
            ret.append("REF_DELTA ");
            break;
        case Constants.OBJ_TAG:
            ret.append("TAG ");
            break;
        case Constants.OBJ_TREE:
            ret.append("TREE ");
            break;
        case Constants.OBJ_TYPE_5:
            ret.append("TYPE_5 ");
            break;
        default:
            ret.append("UNKNOWN[").append(loader.getType()).append("] ");
            break;
        }

        ret.append(String.format("Size=%,d", loader.getSize()));
        return ret.toString();
    } catch (MissingObjectException e) {
        LOG.log(Level.WARNING, "Unable to open objectId: " + objectId, e);
        return "<missing object>";
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Unable to open objectId: " + objectId, e);
        return "<unable to open object>";
    }
}