git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Is there a way to get the "format-patch" formatted file name?

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 1, 2023, 16:04 UTC
Message-ID
<xmqqsf7xribk.fsf@gitster.g>
In-Reply-To
<xmqqwmx9ritx.fsf@gitster.g>
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);
Previous: Junio C HamanoNext: Vít Ondruch
Message 9 of 10 in “Is there a way to get the "format-patch" formatted file name?”
  1. Vít OndruchAug 31, 2023
  2. Oswald BuddenhagenAug 31, 2023
  3. Vít OndruchAug 31, 2023
  4. Oswald BuddenhagenAug 31, 2023
  5. Junio C HamanoAug 31, 2023
  6. Vít OndruchSep 1, 2023
  7. Oswald BuddenhagenSep 1, 2023
  8. Junio C HamanoSep 1, 2023
  9. Junio C HamanoSep 1, 2023
  10. Vít OndruchSep 1, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.