Example usage for org.eclipse.jgit.util RawParseUtils committer

List of usage examples for org.eclipse.jgit.util RawParseUtils committer

Introduction

In this page you can find the example usage for org.eclipse.jgit.util RawParseUtils committer.

Prototype

public static final int committer(byte[] b, int ptr) 

Source Link

Document

Locate the "committer " header line data.

Usage

From source file:playRepository.GitCommit.java

License:Apache License

/**
 * Parse the committer identity from the raw buffer.
 * <p>//from  w  w  w . j  a  v  a2  s.c  o  m
 * This method parses and returns the content of the committer line, after
 * taking the commit's character set into account and decoding the committer
 * name and email address. This method is fairly expensive and produces a
 * new PersonIdent instance on each invocation. Callers should invoke this
 * method only if they are certain they will be outputting the result, and
 * should cache the return value for as long as necessary to use all
 * information from it.
 * <p>
 * RevFilter implementations should try to use {@link RawParseUtils} to scan
 * the {@link RevCommit#getRawBuffer()} instead, as this will allow faster evaluation
 * of commits.
 *
 * @return identity of the committer (name, email) and the time the commit
 *         was made by the committer; null if no committer line was found.
 */
public final PersonIdent getCommitterIdent() {
    if (committerIdent == null) {
        final byte[] raw = revCommit.getRawBuffer();
        final int nameB = RawParseUtils.committer(raw, 0);
        if (nameB < 0)
            return null;
        committerIdent = parsePersonIdent(raw, nameB, Charset.defaultCharset());
    }

    return committerIdent;
}