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

[PATCH 2/2] mailinfo: Understand forwarded patches

From
MWMatthew Wilcox <mawilcox@linuxonhyperv.com>
Date
Jan 12, 2017, 09:20 UTC
Message-ID
<1484212824-14108-2-git-send-email-mawilcox@linuxonhyperv.com>
In-Reply-To
<1484212824-14108-1-git-send-email-mawilcox@linuxonhyperv.com>
From: Matthew Wilcox <mawilcox@microsoft.com>

Extend the --scissors mechanism to strip off the preamble created by forwarding a patch. There are a couple of extra headers ("Sent" and "To") added by forwarding, but other than that, the --scissors option will now remove patches forwarded from Microsoft Outlook to a Linux email account.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
 mailinfo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mailinfo.c b/mailinfo.c
index 2059704a8..fc1275532 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -332,7 +332,7 @@ static void cleanup_subject(struct mailinfo *mi, struct strbuf *subject)
 
 #define MAX_HDR_PARSED 10
 static const char *header[MAX_HDR_PARSED] = {
-	"From","Subject","Date",
+	"From","Subject","Date","Sent","To",
 };
 
 static inline int cmp_header(const struct strbuf *line, const char *hdr)
@@ -685,6 +685,13 @@ static int is_scissors_line(const char *line)
 			c++;
 			continue;
 		}
+		if (!memcmp(c, "Original Message", 16)) {
+			in_perforation = 1;
+			perforation += 16;
+			scissors += 16;
+			c += 15;
+			continue;
+		}
 		in_perforation = 0;
 	}
 
-- 
2.11.0
Previous: Matthew WilcoxNext: Jonathan Tan
Message 2 of 7 in “mailinfo: Add support for keep_cr”
  1. 1/2 mailinfo: Add support for keep_crMatthew Wilcox, Jan 12, 2017
  2. 2/2 mailinfo: Understand forwarded patchesMatthew Wilcox, Jan 12, 2017
  3. Jonathan TanJan 12, 2017
  4. Matthew WilcoxJan 12, 2017
  5. Junio C HamanoJan 12, 2017
  6. Jonathan TanJan 12, 2017
  7. Matthew WilcoxJan 12, 2017

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.