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

Re: git-am doesn't strip CRLF line endings when the mbox is base64-encoded

From
GDGeorge Dunlap <george.dunlap@citrix.com>
Date
Dec 18, 2019, 12:15 UTC
Message-ID
<dece7350-7b58-bf19-9fdf-4ccf8df268fb@citrix.com>
In-Reply-To
<c44c3958-b0eb-22bd-bc35-04982706162f@citrix.com>
On 12/18/19 11:42 AM, George Dunlap wrote:
Show 13 quoted lines
> Using git 2.24.0 from Debian testing.
> 
> It seems that git-am will strip CRLF endings from mails before applying
> patches when the mail isn't encoded in any way.  It will also decode
> base64-encoded mails.  But it won't strip CRLF endings from
> base64-encoded mails.
> 
> Attached are two mbox files for two different recent series.
> plainenc.am applies cleanly with `git am`, while base64enc.am doesn't.
> 
> Poking around the man pages, it looks like part of the issue might be
> that the CRLF stripping is done in `git mailsplit`, before the base64
> encoding, rather than after.

Poking around -- it looks like the CRLF stripping would be better done in `git mailinfo` after the decoding.

Also, this can *almost* be worked around using hooks -- there's an `applypatch-msg` hook which can strip the CLRFs from the commit message, but no hook (AFAICT) corresponding `applypatch-patch` which is run on the patch itself before being applied.

 -George
Previous: George DunlapNext: Todd Zullinger
Message 2 of 6 in “git-am doesn't strip CRLF line endings when the mbox is base64-encoded”
  1. George DunlapDec 18, 2019
  2. George DunlapDec 18, 2019
  3. Todd ZullingerDec 18, 2019
  4. George DunlapJan 6, 2020
  5. Junio C HamanoJan 6, 2020
  6. George DunlapJan 6, 2020

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.