Example usage for org.eclipse.jgit.lib TreeFormatter insertTo

List of usage examples for org.eclipse.jgit.lib TreeFormatter insertTo

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib TreeFormatter insertTo.

Prototype

public ObjectId insertTo(ObjectInserter ins) throws IOException 

Source Link

Document

Insert this tree and obtain its ObjectId.

Usage

From source file:com.microsoft.gittf.core.tasks.CreateCommitTask.java

License:Open Source License

private ObjectId createTree(final ObjectInserter repositoryInserter,
        final Map<CommitTreePath, CommitTreeEntry> tree) throws IOException {
    if (tree.isEmpty()) {
        return createEmptyTree(repositoryInserter);
    }/* w w w. j ava2  s .  c  om*/

    TreeFormatter treeFormatter = new TreeFormatter();

    for (Entry<CommitTreePath, CommitTreeEntry> entry : tree.entrySet()) {
        String name = entry.getKey().getName();
        FileMode mode = entry.getValue().getFileMode();
        ObjectId objectId = entry.getValue().getObjectID();

        treeFormatter.append(name, mode, objectId);
    }

    return treeFormatter.insertTo(repositoryInserter);
}

From source file:com.microsoft.gittf.core.tasks.CreateCommitTask.java

License:Open Source License

protected ObjectId createEmptyTree(ObjectInserter repositoryInserter) throws IOException {
    TreeFormatter treeFormatter = new TreeFormatter();
    return treeFormatter.insertTo(repositoryInserter);
}