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

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

Introduction

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

Prototype

String SIGNED_OFF_BY_TAG

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

Click Source Link

Document

Beginning of the common "Signed-off-by: " commit message line

Usage

From source file:org.eclipse.egit.ui.internal.dialogs.CommitDialog.java

License:Open Source License

private String getSignedOff(String signer) {
    return Constants.SIGNED_OFF_BY_TAG + signer;
}

From source file:org.eclipse.egit.ui.internal.staging.StagingView.java

License:Open Source License

private boolean userEnteredCommmitMessage() {
    if (commitMessageComponent.getRepository() == null)
        return false;
    String message = commitMessageComponent.getCommitMessage().replace(UIText.StagingView_headCommitChanged,
            ""); //$NON-NLS-1$
    if (message == null || message.trim().length() == 0)
        return false;

    String chIdLine = "Change-Id: I" + ObjectId.zeroId().name(); //$NON-NLS-1$

    if (currentRepository.getConfig().getBoolean(ConfigConstants.CONFIG_GERRIT_SECTION,
            ConfigConstants.CONFIG_KEY_CREATECHANGEID, false) && commitMessageComponent.getCreateChangeId()) {
        if (message.trim().equals(chIdLine))
            return false;

        // change id was added automatically, but ther is more in the
        // message; strip the id, and check for the signed-off-by tag
        message = message.replace(chIdLine, ""); //$NON-NLS-1$
    }/* ww w. jav  a 2 s. c  om*/

    if (org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
            .getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY) && commitMessageComponent.isSignedOff()
            && message.trim().equals(Constants.SIGNED_OFF_BY_TAG + commitMessageComponent.getCommitter()))
        return false;

    return true;
}

From source file:org.gitective.tests.SignedOffByTest.java

License:Open Source License

/**
 * Test match//from w w  w .j a  v a2  s  .  c  o m
 * 
 * @throws Exception
 */
@Test
public void match() throws Exception {
    PersonIdent person = new PersonIdent("Test user", "test@user.com");
    add("file.txt", "patch",
            Constants.SIGNED_OFF_BY_TAG + person.getName() + " <" + person.getEmailAddress() + ">");

    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person), count));
    service.find();
    assertEquals(1, count.getCount());

    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person).clone(), count));
    service.find();
    assertEquals(2, count.getCount());
}

From source file:org.gitective.tests.SignedOffByTest.java

License:Open Source License

/**
 * Test non-match/*w ww  .ja va2  s .  c  om*/
 * 
 * @throws Exception
 */
@Test
public void nonMatch() throws Exception {
    PersonIdent person = new PersonIdent("Test user", "test@user.com");
    add("file.txt", "patch", Constants.SIGNED_OFF_BY_TAG + "person");

    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person), count));
    service.find();
    assertEquals(0, count.getCount());
}