MCPcopy Create free account
hub / github.com/git/git / insert_records_from_trailers

Function insert_records_from_trailers

builtin/shortlog.c:169–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169static 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
209out:
210 strbuf_release(&ident);
211 repo_unuse_commit_buffer(the_repository, commit, commit_buffer);
212}
213
214static int shortlog_needs_dedup(const struct shortlog *log)
215{

Callers 1

shortlog_add_commitFunction · 0.85

Calls 10

repo_logmsg_reencodeFunction · 0.85
trailer_iterator_initFunction · 0.85
trailer_iterator_advanceFunction · 0.85
string_list_has_stringFunction · 0.85
strset_addFunction · 0.85
insert_one_recordFunction · 0.85
trailer_iterator_releaseFunction · 0.85
strbuf_releaseFunction · 0.85
repo_unuse_commit_bufferFunction · 0.85
parse_identFunction · 0.70

Tested by

no test coverage detected