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

Function Repository_reset

src/repository.c:2056–2082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2054 " working copy and the content of the index.\n");
2055
2056PyObject *
2057Repository_reset(Repository *self, PyObject* args)
2058{
2059 PyObject *py_oid;
2060 git_oid oid;
2061 git_object *target = NULL;
2062 int err, reset_type;
2063 size_t len;
2064
2065 if (!PyArg_ParseTuple(args, "Oi",
2066 &py_oid,
2067 &reset_type
2068 ))
2069 return NULL;
2070
2071 len = py_oid_to_git_oid(py_oid, &oid);
2072 if (len == 0)
2073 return NULL;
2074
2075 err = git_object_lookup_prefix(&target, self->repo, &oid, len,
2076 GIT_OBJECT_ANY);
2077 err = err < 0 ? err : git_reset(self->repo, target, reset_type, NULL);
2078 git_object_free(target);
2079 if (err < 0)
2080 return Error_set_oid(err, &oid, len);
2081 Py_RETURN_NONE;
2082}
2083
2084PyDoc_STRVAR(Repository_free__doc__,
2085 "free()\n"

Callers

nothing calls this directly

Calls 2

py_oid_to_git_oidFunction · 0.85
Error_set_oidFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…