git.notesAdd().setMessage("some note message").setObjectId(commit).call(); System.out.println("Added Note to commit " + commit);
git.notesAdd().setMessage("some note message").setObjectId(commit).call(); System.out.println("Added Note to commit " + commit);
/** * Creates a note to a commit. * * @param com - the RevObject fo the commit * @param note - the note text. * @throws GitAPIException - failed. */ public void addNote(final RevObject com, final String note) throws GitAPIException { git.notesAdd() .setObjectId(com) .setMessage(note) .call(); }
@Override public void write(String str) { try (Git git = updater.open()) { RevWalk walk = new RevWalk(git.getRepository()); RevCommit commit = walk.parseCommit(updater.getBaseObjectId(git)); git.notesAdd().setNotesRef(GIT_NOTES_REF) .setObjectId(commit) .setMessage(str).call(); } catch (Exception e) { log.error("Error writing Tests Report in the Git Notes", e); throw new RuntimeException("Error from the GitNotesWriter", e); } } }
/** {@inheritDoc} */ @Override public void addNote(String note, String namespace) throws GitException { try (Repository repo = getRepository()) { ObjectId head = repo.resolve(HEAD); // commit to put a note on AddNoteCommand cmd = git(repo).notesAdd(); cmd.setMessage(normalizeNote(note)); cmd.setNotesRef(qualifyNotesNamespace(namespace)); try (ObjectReader or = repo.newObjectReader(); RevWalk walk = new RevWalk(or)) { cmd.setObjectId(walk.parseAny(head)); cmd.call(); } } catch (GitAPIException | IOException e) { throw new GitException(e); } }