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

Function handle_info

mailinfo.c:1157–1193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1155}
1156
1157static void handle_info(struct mailinfo *mi)
1158{
1159 struct strbuf *hdr;
1160 int i;
1161
1162 for (i = 0; i < ARRAY_SIZE(header); i++) {
1163 /* only print inbody headers if we output a patch file */
1164 if (mi->patch_lines && mi->s_hdr_data[i])
1165 hdr = mi->s_hdr_data[i];
1166 else if (mi->p_hdr_data[i])
1167 hdr = mi->p_hdr_data[i];
1168 else
1169 continue;
1170
1171 if (memchr(hdr->buf, '\0', hdr->len)) {
1172 error("a NUL byte in '%s' is not allowed.", header[i]);
1173 mi->input_error = -1;
1174 }
1175
1176 if (!strcmp(header[i], "Subject")) {
1177 if (!mi->keep_subject) {
1178 cleanup_subject(mi, hdr);
1179 cleanup_space(hdr);
1180 }
1181 output_header_lines(mi->output, "Subject", hdr);
1182 } else if (!strcmp(header[i], "From")) {
1183 cleanup_space(hdr);
1184 handle_from(mi, hdr);
1185 fprintf(mi->output, "Author: %s\n", mi->name.buf);
1186 fprintf(mi->output, "Email: %s\n", mi->email.buf);
1187 } else {
1188 cleanup_space(hdr);
1189 fprintf(mi->output, "%s: %s\n", header[i], hdr->buf);
1190 }
1191 }
1192 fprintf(mi->output, "\n");
1193}
1194
1195int mailinfo(struct mailinfo *mi, const char *msg, const char *patch)
1196{

Callers 1

mailinfoFunction · 0.70

Calls 5

errorFunction · 0.85
cleanup_subjectFunction · 0.70
cleanup_spaceFunction · 0.70
output_header_linesFunction · 0.70
handle_fromFunction · 0.70

Tested by

no test coverage detected