| 543 | "Looks up a reference and returns it, or None if not found."); |
| 544 | |
| 545 | PyObject * |
| 546 | RefdbBackend_lookup(RefdbBackend *self, PyObject *py_str) |
| 547 | { |
| 548 | int err; |
| 549 | git_reference *ref; |
| 550 | const char *ref_name; |
| 551 | if (self->refdb_backend->lookup == NULL) { |
| 552 | Py_INCREF(Py_NotImplemented); |
| 553 | return Py_NotImplemented; |
| 554 | } |
| 555 | |
| 556 | if (!PyUnicode_Check(py_str)) { |
| 557 | PyErr_SetString(PyExc_TypeError, |
| 558 | "RefdbBackend.lookup takes a string argument"); |
| 559 | return NULL; |
| 560 | } |
| 561 | ref_name = PyUnicode_AsUTF8(py_str); |
| 562 | |
| 563 | err = self->refdb_backend->lookup(&ref, self->refdb_backend, ref_name); |
| 564 | |
| 565 | if (err == GIT_ENOTFOUND) { |
| 566 | Py_RETURN_NONE; |
| 567 | } else if (err != 0) { |
| 568 | return Error_set(err); |
| 569 | } |
| 570 | |
| 571 | return wrap_reference(ref, NULL); |
| 572 | } |
| 573 | |
| 574 | PyDoc_STRVAR(RefdbBackend_write__doc__, |
| 575 | "write(ref: Reference, force: bool, who: Signature, message: str, old: Oid, old_target: str)\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…