| 167 | } |
| 168 | |
| 169 | static void insert_records_from_trailers(struct shortlog *log, |
| 170 | struct strset *dups, |
| 171 | struct commit *commit, |
| 172 | struct pretty_print_context *ctx, |
| 173 | const char *oneline) |
| 174 | { |
| 175 | struct trailer_iterator iter; |
| 176 | const char *commit_buffer, *body; |
| 177 | struct strbuf ident = STRBUF_INIT; |
| 178 | |
| 179 | if (!log->trailers.nr) |
| 180 | return; |
| 181 | |
| 182 | /* |
| 183 | * Using repo_format_commit_message("%B") would be simpler here, but |
| 184 | * this saves us copying the message. |
| 185 | */ |
| 186 | commit_buffer = repo_logmsg_reencode(the_repository, commit, NULL, |
| 187 | ctx->output_encoding); |
| 188 | body = strstr(commit_buffer, "\n\n"); |
| 189 | if (!body) |
| 190 | goto out; |
| 191 | |
| 192 | trailer_iterator_init(&iter, body); |
| 193 | while (trailer_iterator_advance(&iter)) { |
| 194 | const char *value = iter.val.buf; |
| 195 | |
| 196 | if (!string_list_has_string(&log->trailers, iter.key.buf)) |
| 197 | continue; |
| 198 | |
| 199 | strbuf_reset(&ident); |
| 200 | if (!parse_ident(log, &ident, value)) |
| 201 | value = ident.buf; |
| 202 | |
| 203 | if (!strset_add(dups, value)) |
| 204 | continue; |
| 205 | insert_one_record(log, value, oneline); |
| 206 | } |
| 207 | trailer_iterator_release(&iter); |
| 208 | |
| 209 | out: |
| 210 | strbuf_release(&ident); |
| 211 | repo_unuse_commit_buffer(the_repository, commit, commit_buffer); |
| 212 | } |
| 213 | |
| 214 | static int shortlog_needs_dedup(const struct shortlog *log) |
| 215 | { |
no test coverage detected