MCPcopy Create free account
hub / github.com/libgit2/pygit2 / wrap_note

Function wrap_note

src/note.c:217–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216
217PyObject *
218wrap_note(Repository* repo, git_oid* note_id, git_oid* annotated_id, const char* ref)
219{
220 Note* py_note = NULL;
221 int err = GIT_ERROR;
222
223 py_note = PyObject_New(Note, &NoteType);
224 if (py_note == NULL) {
225 PyErr_NoMemory();
226 return NULL;
227 }
228
229 Py_INCREF(repo);
230 py_note->repo = repo;
231 py_note->ref = ref;
232 py_note->annotated_id = git_oid_to_python(annotated_id);
233 py_note->id = NULL;
234 py_note->note = NULL;
235
236 /* If the note has been provided, defer the git_note_read() call */
237 if (note_id != NULL) {
238 py_note->id = git_oid_to_python(note_id);
239 } else {
240 err = git_note_read(&py_note->note, repo->repo, ref, annotated_id);
241 if (err < 0) {
242 Py_DECREF(py_note);
243 return Error_set(err);
244 }
245 py_note->id = git_oid_to_python(git_note_id(py_note->note));
246 }
247
248 return (PyObject*) py_note;
249}
250
251

Callers 2

Repository_lookup_noteFunction · 0.85
NoteIter_iternextFunction · 0.85

Calls 2

git_oid_to_pythonFunction · 0.85
Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…