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

Function Commit_message_trailers__get__

src/commit.c:104–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102);
103
104PyObject *
105Commit_message_trailers__get__(Commit *self)
106{
107 git_message_trailer_array gmt_arr;
108 int i, trailer_count, err;
109 PyObject *dict;
110 PyObject *py_val;
111 const char *message = git_commit_message(self->commit);
112 const char *encoding = git_commit_message_encoding(self->commit);
113
114 err = git_message_trailers(&gmt_arr, message);
115 if (err < 0)
116 return Error_set(err);
117
118 dict = PyDict_New();
119 if (dict == NULL)
120 goto error;
121
122 trailer_count = gmt_arr.count;
123 for (i=0; i < trailer_count; i++) {
124 py_val = to_unicode(gmt_arr.trailers[i].value, encoding, NULL);
125 err = PyDict_SetItemString(dict, gmt_arr.trailers[i].key, py_val);
126 Py_DECREF(py_val);
127 if (err < 0)
128 goto error;
129
130 }
131
132 git_message_trailer_array_free(&gmt_arr);
133 return dict;
134
135error:
136 git_message_trailer_array_free(&gmt_arr);
137 Py_CLEAR(dict);
138 return NULL;
139}
140
141PyDoc_STRVAR(Commit_raw_message__doc__, "Message (bytes).");
142

Callers

nothing calls this directly

Calls 1

Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…