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

Function Commit_gpg_signature__get__

src/commit.c:69–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67PyDoc_STRVAR(Commit_gpg_signature__doc__, "A tuple with the GPG signature and the signed payload.");
68
69PyObject *
70Commit_gpg_signature__get__(Commit *self)
71{
72 git_buf gpg_signature = { NULL }, signed_data = { NULL };
73 PyObject *py_gpg_signature, *py_signed_data;
74
75 const git_oid *oid = Object__id((Object*)self);
76 int err = git_commit_extract_signature(
77 &gpg_signature, &signed_data, self->repo->repo, (git_oid*) oid, NULL
78 );
79
80 if (err != GIT_OK){
81 git_buf_dispose(&gpg_signature);
82 git_buf_dispose(&signed_data);
83
84 if (err == GIT_ENOTFOUND){
85 return Py_BuildValue("OO", Py_None, Py_None);
86 }
87
88 return Error_set(err);
89 }
90
91 py_gpg_signature = PyBytes_FromString(gpg_signature.ptr);
92 py_signed_data = PyBytes_FromString(signed_data.ptr);
93 git_buf_dispose(&gpg_signature);
94 git_buf_dispose(&signed_data);
95
96 return Py_BuildValue("NN", py_gpg_signature, py_signed_data);
97}
98
99
100PyDoc_STRVAR(Commit_message_trailers__doc__,

Callers

nothing calls this directly

Calls 2

Object__idFunction · 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…