Fix issues with submodules regarding refcounting.
This commit is contained in:
@@ -80,6 +80,7 @@ wrap_repository(git_repository *c_repo)
|
|||||||
py_repo->repo = c_repo;
|
py_repo->repo = c_repo;
|
||||||
py_repo->config = NULL;
|
py_repo->config = NULL;
|
||||||
py_repo->index = NULL;
|
py_repo->index = NULL;
|
||||||
|
py_repo->owned = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (PyObject *)py_repo;
|
return (PyObject *)py_repo;
|
||||||
|
@@ -69,7 +69,9 @@ PyDoc_STRVAR(Submodule_path__doc__,
|
|||||||
PyObject *
|
PyObject *
|
||||||
Submodule_path__get__(Submodule *self)
|
Submodule_path__get__(Submodule *self)
|
||||||
{
|
{
|
||||||
return to_unicode(git_submodule_path(self->submodule), NULL, NULL);
|
const char *path = git_submodule_path(self->submodule);
|
||||||
|
assert(path);
|
||||||
|
return to_unicode(path, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(Submodule_url__doc__,
|
PyDoc_STRVAR(Submodule_url__doc__,
|
||||||
@@ -80,7 +82,7 @@ Submodule_url__get__(Submodule *self)
|
|||||||
{
|
{
|
||||||
const char *url = git_submodule_url(self->submodule);
|
const char *url = git_submodule_url(self->submodule);
|
||||||
if (url == NULL)
|
if (url == NULL)
|
||||||
return Py_None;
|
Py_RETURN_NONE;
|
||||||
return to_unicode(url, NULL, NULL);
|
return to_unicode(url, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +94,7 @@ Submodule_branch__get__(Submodule *self)
|
|||||||
{
|
{
|
||||||
const char *branch = git_submodule_branch(self->submodule);
|
const char *branch = git_submodule_branch(self->submodule);
|
||||||
if (branch == NULL)
|
if (branch == NULL)
|
||||||
return Py_None;
|
Py_RETURN_NONE;
|
||||||
return to_unicode(branch, NULL, NULL);
|
return to_unicode(branch, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +170,8 @@ wrap_submodule(Repository *repo, git_submodule *c_submodule)
|
|||||||
py_submodule = PyObject_New(Submodule, &SubmoduleType);
|
py_submodule = PyObject_New(Submodule, &SubmoduleType);
|
||||||
if (py_submodule) {
|
if (py_submodule) {
|
||||||
py_submodule->submodule = c_submodule;
|
py_submodule->submodule = c_submodule;
|
||||||
|
py_submodule->repo = repo;
|
||||||
if (repo) {
|
if (repo) {
|
||||||
py_submodule->repo = repo;
|
|
||||||
Py_INCREF(repo);
|
Py_INCREF(repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user