| 353 | }; |
| 354 | |
| 355 | PyObject * |
| 356 | wrap_object(git_object *c_object, Repository *repo, const git_tree_entry *entry) |
| 357 | { |
| 358 | Object *py_obj = NULL; |
| 359 | |
| 360 | git_object_t obj_type = (c_object) ? git_object_type(c_object) : git_tree_entry_type(entry); |
| 361 | |
| 362 | switch (obj_type) { |
| 363 | case GIT_OBJECT_COMMIT: |
| 364 | py_obj = PyObject_New(Object, &CommitType); |
| 365 | break; |
| 366 | case GIT_OBJECT_TREE: |
| 367 | py_obj = PyObject_New(Object, &TreeType); |
| 368 | break; |
| 369 | case GIT_OBJECT_BLOB: |
| 370 | py_obj = PyObject_New(Object, &BlobType); |
| 371 | break; |
| 372 | case GIT_OBJECT_TAG: |
| 373 | py_obj = PyObject_New(Object, &TagType); |
| 374 | break; |
| 375 | default: |
| 376 | assert(0); |
| 377 | } |
| 378 | |
| 379 | if (py_obj) { |
| 380 | py_obj->obj = c_object; |
| 381 | if (repo) { |
| 382 | py_obj->repo = repo; |
| 383 | Py_INCREF(repo); |
| 384 | } |
| 385 | py_obj->entry = entry; |
| 386 | } |
| 387 | return (PyObject *)py_obj; |
| 388 | } |
no outgoing calls
searching dependent graphs…