| 215 | |
| 216 | |
| 217 | PyObject * |
| 218 | wrap_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 |
no test coverage detected
searching dependent graphs…