/** {@inheritDoc} */ @Override public Note call() throws GitAPIException { checkCallable(); NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { Ref ref = repo.findRef(notesRef); // if we have a notes ref, use it if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, message, inserter); commitNoteMap(repo, notesRef, walk, map, notesCommit, inserter, "Notes added by 'git notes add'"); //$NON-NLS-1$ return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** {@inheritDoc} */ @Override public Note call() throws GitAPIException { checkCallable(); try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; Ref ref = repo.exactRef(notesRef); // if we have a notes ref, use it if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, null, inserter); AddNoteCommand.commitNoteMap(repo, notesRef, walk, map, notesCommit, inserter, "Notes removed by 'git notes remove'"); //$NON-NLS-1$ return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
public Note call() throws GitAPIException { checkCallable(); NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { Ref ref = repo.findRef(notesRef); // if we have a notes ref, use it if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, message, inserter); commitNoteMap(walk, map, notesCommit, inserter, "Notes added by 'git notes add'"); //$NON-NLS-1$ return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** {@inheritDoc} */ @Override public Note call() throws GitAPIException { checkCallable(); NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { Ref ref = repo.findRef(notesRef); // if we have a notes ref, use it if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, message, inserter); commitNoteMap(repo, notesRef, walk, map, notesCommit, inserter, "Notes added by 'git notes add'"); //$NON-NLS-1$ return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** {@inheritDoc} */ @Override public Note call() throws GitAPIException { checkCallable(); try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; Ref ref = repo.exactRef(notesRef); // if we have a notes ref, use it if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, null, inserter); AddNoteCommand.commitNoteMap(repo, notesRef, walk, map, notesCommit, inserter, "Notes removed by 'git notes remove'"); //$NON-NLS-1$ return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }