MCPcopy Index your code
hub / github.com/git/git / print_commit_summary

Function print_commit_summary

sequencer.c:1413–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1411}
1412
1413void print_commit_summary(struct repository *r,
1414 const char *prefix,
1415 const struct object_id *oid,
1416 unsigned int flags)
1417{
1418 struct rev_info rev;
1419 struct commit *commit;
1420 struct strbuf format = STRBUF_INIT;
1421 const char *head;
1422 struct pretty_print_context pctx = {0};
1423 struct strbuf author_ident = STRBUF_INIT;
1424 struct strbuf committer_ident = STRBUF_INIT;
1425 struct ref_store *refs;
1426
1427 commit = lookup_commit(r, oid);
1428 if (!commit)
1429 die(_("couldn't look up newly created commit"));
1430 if (repo_parse_commit(r, commit))
1431 die(_("could not parse newly created commit"));
1432
1433 strbuf_addstr(&format, "format:%h] %s");
1434
1435 repo_format_commit_message(r, commit, "%an <%ae>", &author_ident,
1436 &pctx);
1437 repo_format_commit_message(r, commit, "%cn <%ce>", &committer_ident,
1438 &pctx);
1439 if (strbuf_cmp(&author_ident, &committer_ident)) {
1440 strbuf_addstr(&format, "\n Author: ");
1441 strbuf_addbuf_percentquote(&format, &author_ident);
1442 }
1443 if (flags & SUMMARY_SHOW_AUTHOR_DATE) {
1444 struct strbuf date = STRBUF_INIT;
1445
1446 repo_format_commit_message(r, commit, "%ad", &date, &pctx);
1447 strbuf_addstr(&format, "\n Date: ");
1448 strbuf_addbuf_percentquote(&format, &date);
1449 strbuf_release(&date);
1450 }
1451 if (!committer_ident_sufficiently_given()) {
1452 strbuf_addstr(&format, "\n Committer: ");
1453 strbuf_addbuf_percentquote(&format, &committer_ident);
1454 if (advice_enabled(ADVICE_IMPLICIT_IDENTITY)) {
1455 strbuf_addch(&format, '\n');
1456 strbuf_addstr(&format, implicit_ident_advice());
1457 }
1458 }
1459 strbuf_release(&author_ident);
1460 strbuf_release(&committer_ident);
1461
1462 repo_init_revisions(r, &rev, prefix);
1463 setup_revisions(0, NULL, &rev, NULL);
1464
1465 rev.diff = 1;
1466 rev.diffopt.output_format =
1467 DIFF_FORMAT_SHORTSTAT | DIFF_FORMAT_SUMMARY;
1468
1469 rev.verbose_header = 1;
1470 rev.show_root_diff = 1;

Callers 2

do_commitFunction · 0.85
cmd_commitFunction · 0.85

Calls 15

lookup_commitFunction · 0.85
repo_parse_commitFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_cmpFunction · 0.85
strbuf_releaseFunction · 0.85
advice_enabledFunction · 0.85
strbuf_addchFunction · 0.85
implicit_ident_adviceFunction · 0.85
repo_init_revisionsFunction · 0.85

Tested by

no test coverage detected