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

Function Tree_contains

src/tree.c:63–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63int
64Tree_contains(Tree *self, PyObject *py_name)
65{
66 if (Object__load((Object*)self) == NULL) { return -1; } // Lazy load
67
68 PyObject *tvalue;
69 char *name = pgit_borrow_fsdefault(py_name, &tvalue);
70 if (name == NULL)
71 return -1;
72
73 git_tree_entry *entry;
74 int err = git_tree_entry_bypath(&entry, self->tree, name);
75 Py_DECREF(tvalue);
76
77 if (err == GIT_ENOTFOUND) {
78 return 0;
79 } else if (err < 0) {
80 Error_set(err);
81 return -1;
82 }
83
84 git_tree_entry_free(entry);
85
86 return 1;
87}
88
89int
90Tree_fix_index(const git_tree *tree, PyObject *py_index)

Callers

nothing calls this directly

Calls 3

Object__loadFunction · 0.85
pgit_borrow_fsdefaultFunction · 0.85
Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…