Junio C Hamano <gitster@xxxxxxxxx> writes: > We can just invent a new label (e.g. "Filesystem-safe-subject:"), > pass the subject string to pretty.c:format_sanitized_subject() and > emit the result next to the existing "Subject:" with that label, and > we can even do so unconditionally without breaking anybody. Such a change would be quite small and simple. mailinfo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git c/mailinfo.c w/mailinfo.c index 931505363c..b0eb646f4e 100644 --- c/mailinfo.c +++ w/mailinfo.c @@ -5,6 +5,7 @@ #include "utf8.h" #include "strbuf.h" #include "mailinfo.h" +#include "pretty.h" static void cleanup_space(struct strbuf *sb) { @@ -1166,11 +1167,16 @@ static void handle_info(struct mailinfo *mi) } if (!strcmp(header[i], "Subject")) { + struct strbuf san = STRBUF_INIT; + if (!mi->keep_subject) { cleanup_subject(mi, hdr); cleanup_space(hdr); } output_header_lines(mi->output, "Subject", hdr); + format_sanitized_subject(&san, hdr->buf, hdr->len); + output_header_lines(mi->output, "Filesystem-Safe-Subject", &san); + strbuf_release(&san); } else if (!strcmp(header[i], "From")) { cleanup_space(hdr); handle_from(mi, hdr);