git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: "Vít Ondruch" <vondruch@redhat.com>, git@vger.kernel.org
Subject: Re: Is there a way to get the "format-patch" formatted file name?
Date: Fri, 01 Sep 2023 09:04:15 -0700	[thread overview]
Message-ID: <xmqqsf7xribk.fsf@gitster.g> (raw)
In-Reply-To: <xmqqwmx9ritx.fsf@gitster.g> (Junio C. Hamano's message of "Fri, 01 Sep 2023 08:53:14 -0700")

Junio C Hamano <gitster@pobox.com> 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);

  reply	other threads:[~2023-09-01 16:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  9:49 Is there a way to get the "format-patch" formatted file name? Vít Ondruch
2023-08-31 11:04 ` Oswald Buddenhagen
2023-08-31 12:13   ` Vít Ondruch
2023-08-31 12:46     ` Oswald Buddenhagen
2023-08-31 17:19 ` Junio C Hamano
2023-09-01  8:56   ` Vít Ondruch
2023-09-01 11:00     ` Oswald Buddenhagen
2023-09-01 15:53       ` Junio C Hamano
2023-09-01 16:04         ` Junio C Hamano [this message]
2023-09-01 16:37         ` Vít Ondruch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsf7xribk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=oswald.buddenhagen@gmx.de \
    --cc=vondruch@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).