MCPcopy Create free account
hub / github.com/libgit2/pygit2 / wrap_object

Function wrap_object

src/object.c:355–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353};
354
355PyObject *
356wrap_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}

Callers 10

Tag_get_objectFunction · 0.85
treeentry_to_objectFunction · 0.85
Reference_peelFunction · 0.85
Object_peelFunction · 0.85
Repository_revparse_extFunction · 0.85
wrap_revspecFunction · 0.85
Commit_tree__get__Function · 0.85
Commit_parents__get__Function · 0.85

Calls

no outgoing calls

Tested by 1

wrap_revspecFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…