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

Function log_write_email_headers

log-tree.c:493–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493void log_write_email_headers(struct rev_info *opt, struct commit *commit,
494 char **extra_headers_p,
495 int *need_8bit_cte_p,
496 int maybe_multipart)
497{
498 struct strbuf headers = STRBUF_INIT;
499 const char *name = oid_to_hex(opt->zero_commit ?
500 null_oid(the_hash_algo) : &commit->object.oid);
501
502 *need_8bit_cte_p = 0; /* unknown */
503
504 if (opt->extra_headers && *opt->extra_headers)
505 strbuf_addstr(&headers, opt->extra_headers);
506
507 fprintf(opt->diffopt.file, "From %s Mon Sep 17 00:00:00 2001\n", name);
508 graph_show_oneline(opt->graph);
509 if (opt->message_id) {
510 fprintf(opt->diffopt.file, "Message-ID: <%s>\n", opt->message_id);
511 graph_show_oneline(opt->graph);
512 }
513 if (opt->ref_message_ids && opt->ref_message_ids->nr > 0) {
514 int i, n;
515 n = opt->ref_message_ids->nr;
516 fprintf(opt->diffopt.file, "In-Reply-To: <%s>\n", opt->ref_message_ids->items[n-1].string);
517 for (i = 0; i < n; i++)
518 fprintf(opt->diffopt.file, "%s<%s>\n", (i > 0 ? "\t" : "References: "),
519 opt->ref_message_ids->items[i].string);
520 graph_show_oneline(opt->graph);
521 }
522 if (opt->mime_boundary && maybe_multipart) {
523 static struct strbuf buffer = STRBUF_INIT;
524 struct strbuf filename = STRBUF_INIT;
525 *need_8bit_cte_p = -1; /* NEVER */
526
527 strbuf_reset(&buffer);
528
529 strbuf_addf(&headers,
530 "MIME-Version: 1.0\n"
531 "Content-Type: multipart/mixed;"
532 " boundary=\"%s%s\"\n"
533 "\n"
534 "This is a multi-part message in MIME "
535 "format.\n"
536 "--%s%s\n"
537 "Content-Type: text/plain; "
538 "charset=UTF-8; format=fixed\n"
539 "Content-Transfer-Encoding: 8bit\n\n",
540 mime_boundary_leader, opt->mime_boundary,
541 mime_boundary_leader, opt->mime_boundary);
542
543 if (opt->numbered_files)
544 strbuf_addf(&filename, "%d", opt->nr);
545 else
546 fmt_output_commit(&filename, commit, opt);
547 strbuf_addf(&buffer,
548 "\n--%s%s\n"
549 "Content-Type: text/x-patch;"
550 " name=\"%s\"\n"

Callers 2

show_logFunction · 0.85
make_cover_letterFunction · 0.85

Calls 8

oid_to_hexFunction · 0.85
null_oidFunction · 0.85
strbuf_addstrFunction · 0.85
graph_show_onelineFunction · 0.85
strbuf_addfFunction · 0.85
fmt_output_commitFunction · 0.85
strbuf_releaseFunction · 0.85
strbuf_detachFunction · 0.85

Tested by

no test coverage detected