Example usage for org.eclipse.jgit.revwalk FooterLine getEmailAddress

List of usage examples for org.eclipse.jgit.revwalk FooterLine getEmailAddress

Introduction

In this page you can find the example usage for org.eclipse.jgit.revwalk FooterLine getEmailAddress.

Prototype

public String getEmailAddress() 

Source Link

Document

Extract the email address (if present) from the footer.

Usage

From source file:com.google.gerrit.server.git.MergeUtil.java

License:Apache License

private static boolean isSignedOffBy(List<FooterLine> footers, String email) {
    for (final FooterLine line : footers) {
        if (line.matches(FooterKey.SIGNED_OFF_BY) && email.equals(line.getEmailAddress())) {
            return true;
        }/*from   w w w.java 2  s . c om*/
    }
    return false;
}

From source file:org.eclipse.foundation.gerrit.validation.EclipseCommitValidationListener.java

License:Open Source License

/**
 * Answer <code>true</code> if the identified user has signed off on the commit,
 * or <code>false</code> otherwise. The user may use any of their identities to
 * sign off on the commit (i.e. they can use any email address that is registered
 * with Gerrit.//from  www  .  j  a v a2 s.  c o m
 * 
 * @param author The Gerrit identity of the author of the commit.
 * @param commit The commit.
 * @return <code>true</code> if the author has signed off; <code>false</code> otherwise.
 */
private boolean hasSignedOff(IdentifiedUser author, RevCommit commit) {
    for (final FooterLine footer : commit.getFooterLines()) {
        if (footer.matches(FooterKey.SIGNED_OFF_BY)) {
            final String email = footer.getEmailAddress();
            if (author.getEmailAddresses().contains(email))
                return true;
        }
    }
    return false;
}