| 102 | ); |
| 103 | |
| 104 | PyObject * |
| 105 | Commit_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 | |
| 135 | error: |
| 136 | git_message_trailer_array_free(&gmt_arr); |
| 137 | Py_CLEAR(dict); |
| 138 | return NULL; |
| 139 | } |
| 140 | |
| 141 | PyDoc_STRVAR(Commit_raw_message__doc__, "Message (bytes)."); |
| 142 |
nothing calls this directly
no test coverage detected
searching dependent graphs…