Example usage for org.eclipse.jgit.api Git notesAdd

List of usage examples for org.eclipse.jgit.api Git notesAdd

Introduction

In this page you can find the example usage for org.eclipse.jgit.api Git notesAdd.

Prototype

public AddNoteCommand notesAdd() 

Source Link

Document

Return a command to add notes to an object

Usage

From source file:gov.va.isaac.sync.git.SyncServiceGIT.java

License:Apache License

private void addNote(String message, Git git) throws IOException, GitAPIException {
    RevWalk walk = new RevWalk(git.getRepository());
    Ref head = git.getRepository().getRef("refs/heads/master");
    RevCommit commit = walk.parseCommit(head.getObjectId());
    git.notesAdd().setObjectId(commit).setMessage(message).call();

}

From source file:org.eclipse.egit.core.test.op.CloneOperationTest.java

License:Open Source License

protected void createNoteInOrigin() throws GitAPIException {
    Git git = new Git(repository1.getRepository());
    git.add().addFilepattern("file.txt").call();
    RevCommit commit = git.commit().setMessage("Initial commit").call();
    git.notesAdd().setNotesRef("refs/notes/review").setObjectId(commit).setMessage("text").call();
}

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

License:Open Source License

/**
 * Add note to latest commit with given content
 *
 * @param content/*from w  ww  .java2  s  . c o m*/
 * @param ref
 * @return note
 * @throws Exception
 */
protected Note note(String content, String ref) throws Exception {
    Git git = Git.open(testRepo);
    Note note = git.notesAdd().setMessage(content).setNotesRef(Constants.R_NOTES + ref)
            .setObjectId(CommitUtils.getHead(git.getRepository())).call();
    assertNotNull(note);
    return note;
}

From source file:sh.isaac.provider.sync.git.SyncServiceGIT.java

License:Apache License

/**
 * Adds the note./*  ww w. ja  v a 2s . c om*/
 *
 * @param message the message
 * @param git the git
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws GitAPIException the git API exception
 */
private void addNote(String message, Git git) throws IOException, GitAPIException {
    try (RevWalk walk = new RevWalk(git.getRepository())) {
        final Ref head = git.getRepository().exactRef("refs/heads/master");
        final RevCommit commit = walk.parseCommit(head.getObjectId());

        git.notesAdd().setObjectId(commit).setMessage(message).call();
    }
}