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

Re: git-am: "Patch fragment without a header"

From
Junio C Hamano <junkio@cox.net>
Date
Feb 7, 2006, 05:35 UTC
Message-ID
<7vfymv3f4y.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<43E814C2.6090104@zytor.com>
"H. Peter Anvin" <hpa@zytor.com> writes:
> Unfortunately git-mailinfo is in C, otherwise I'd have suggested using
> the Perl MIME-tools, which seems to have all this stuff in it.

Heh, spawn Perl for every message? I'd be ****ed by Linus if I did so ;-).

This should fix it and I'd appreciate if you try it on other messages.

I tried it on the message you quoted with:
    git-mailinfo -u /var/tmp/msg /var/tmp/patch <./+hpa.eml >/var/tmp/info

The resulting 'msg' and 'info' looks reasonable utf8 and patch was not corrupt.

-- >8 -- [PATCH] mailinfo: reset CTE after each multipart

If the first part uses quoted-printable to protect iso8859-1 name in the commit log, and the second part was plain ascii text patchfile without even Content-Transfer-Encoding subheader, we incorrectly tried to decode the patch as quoted printable.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/mailinfo.c b/mailinfo.c
index 0265a29..ff2d4d4 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -707,6 +707,9 @@ static void handle_multipart_body(void)
 		if (!len) {
 			if (handle_multipart_one_part() < 0)
 				return;
+			/* Reset per part headers */
+			transfer_encoding = TE_DONTCARE;
+			charset[0] = 0;
 		}
 		else
 			check_subheader_line(line, len);
Previous: H. Peter AnvinNext: Linus Torvalds
Message 4 of 5 in “git-am: "Patch fragment without a header"”
  1. H. Peter AnvinFeb 7, 2006
  2. Junio C HamanoFeb 7, 2006
  3. H. Peter AnvinFeb 7, 2006
  4. Junio C HamanoFeb 7, 2006
  5. Linus TorvaldsFeb 7, 2006

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.