Skip to content

Commit b37939a

Browse files
committed
OdbBackend: initial pass on Python subclassing
The basic approach here is to have backends created from C (loose, pack) circumvent the OdbBackend_init function. However, backends created from Python will not. We then use this backend to pull out the functions implemented in Python and rig them up through shim functions to the libgit2 git_odb_backend.
1 parent 8a63350 commit b37939a

File tree

3 files changed

+419
-10
lines changed

3 files changed

+419
-10
lines changed

src/odb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Odb_read_raw(git_odb *odb, const git_oid *oid, size_t len)
158158
int err;
159159

160160
err = git_odb_read_prefix(&obj, odb, oid, (unsigned int)len);
161-
if (err < 0) {
161+
if (err < 0 && err != GIT_EUSER) {
162162
Error_set_oid(err, oid, len);
163163
return NULL;
164164
}
@@ -288,7 +288,7 @@ Odb_add_backend(Odb *self, PyObject *args)
288288
}
289289

290290
err = git_odb_add_backend(self->odb, backend->odb_backend, priority);
291-
if (err > 0)
291+
if (err != 0)
292292
return Error_set(err);
293293

294294
Py_RETURN_NONE;

0 commit comments

Comments
 (0)