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

Re: git imap-send converting my patches to CRLF line endings?

From
Jeff King <peff@peff.net>
Date
Jun 17, 2011, 15:50 UTC
Message-ID
<20110617155031.GA24009@sigill.intra.peff.net>
In-Reply-To
<Oe8m5NtYZicsi6Z4FtNIXAfsB9Q9XcHSsoAYmKdxQkoDVJOKykQTEg@cipher.nrlssc.navy.mil>
On Fri, Jun 17, 2011 at 10:37:54AM -0500, Brandon Casey wrote:
Show 9 quoted lines
> >> $ git format-patch --stdout --keep-subject --attach origin | git imap-send
> 
> Wait a second.  You used --attach.
> 
> >> 2. Open Gmail in Chrome.
> >> 3. Open email in drafts folder.
> >> 4. Click attachment download link
> 
> Then you downloaded the attachment, which should be a _patch_.

Yeah, but if it is text/*, then according to rfc2046, it must be represented with CRLF as the line break. And especially if we are including it unencoded in a message, it is going to need CR's added.

Show 7 quoted lines
> >> 5. Apply patch on a fresh branch with git apply.
> 
> Well, scratch what I said before, you were correct in using
> git apply.
>
> Shouldn't the attachment have it's content preserved exactly?  Maybe
> the fault does belong to gmail.

Is it gmail's fault, or the browser's? If gmail is handing back a text/* content-type, then my reading of rfc2046 is that it should have CRLF line breaks. And it would be the browser's responsibility to convert to native line endings. But that's the MIME spec, and was written with mail in mind; I don't know what's normal for HTTP in these situations. But if the problem is not "strip CR" but "convert to native line endings" (which I think it is), then how could gmail know the user's native line ending preference, anyway?

-Peff
Previous: Brandon CaseyNext: Brandon Casey
Message 6 of 10 in “git imap-send converting my patches to CRLF line endings?”
  1. Michael Mc DonnellJun 17, 2011
  2. Jeff KingJun 17, 2011
  3. Michael Mc DonnellJun 17, 2011
  4. Brandon CaseyJun 17, 2011
  5. Brandon CaseyJun 17, 2011
  6. Jeff KingJun 17, 2011
  7. Brandon CaseyJun 17, 2011
  8. Michael Mc DonnellJun 20, 2011
  9. Brandon CaseyJun 17, 2011
  10. Jeff KingJun 17, 2011

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.