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

Re: am fails to apply patches for files with CRLF lineendings

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Dec 14, 2009, 20:55 UTC
Message-ID
<20091214205517.GA1317@atjola.homenet>
In-Reply-To
<776A5AB0-E6BC-4230-800E-BE1B7A6B09BF@silentcow.com>
On 2009.12.14 12:38:30 -0800, Jason King wrote:
Show 33 quoted lines
> On Dec 14, 2009, at 12:27 PM, Junio C Hamano wrote:
> 
> >Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> >
> >>Commit c2ca1d7 "Allow mailsplit ... to handle mails with CRLF
> >>line-endings"
> >>seems to be responsible.
> >
> >Yes, that commit is not only responsible but was deliberate.  For
> >a better
> >backstory, see:
> >
> > http://thread.gmane.org/gmane.comp.version-control.git/124718/focus=124721
> >
> >You'd notice that I was one of the people who didn't want to have this
> >change, so you don't need to convince _me_ that this was not a
> >change to
> >keep everybody happy, but you'd need to try a better job than I
> >did back
> >then to convince people who thought that "am" should directly work on
> >"Thunderbird saved mails" that what they want was a bad idea X-<.
> 
> I dunno Junio, the back story doesn't really seem like a convincing
> argument for totally breaking am's handling of real CRLFs.  Right
> now, it seems to be a very bad thing that git can create a patch
> that it can't apply.  The default am should always be able to apply
> whatever format-patch has generated.
> 
> If it's desirable to have am translate CRLFs to LFs, then why not
> provide this as an option to am so as not to break merging of real
> CRLF patches?  Eg.:
> 
>   git am --convert-crlf

Hm, currently it checks everyline. I didn't really think this through, but wouldn't it makes sense to have a per-mail flag, that checks just the first line, and if that has CRLF, then enable the dropping (unless --keep-cr is given), otherwise, keep things verbatim. That should (I think) make things work with non-messed up patches regardless of the files being patch, as well as with messed up patches as long as they don't try to patch files with CRLF line-endings.

I can't seem to come up with a clean patch though (btw, is the comment for split_one that says that buf may contain a partial line still true?), but maybe I'll find some time to try again later this week (don't count on it though, I'm pretty stressed...)

Björn
Previous: Junio C HamanoNext: Jason King
Message 6 of 18 in “am fails to apply patches for files with CRLF lineendings”
  1. Björn SteinbrinkDec 14, 2009
  2. Junio C HamanoDec 14, 2009
  3. Junio C HamanoDec 14, 2009
  4. Brandon CaseyDec 14, 2009
  5. Junio C HamanoDec 14, 2009
  6. Björn SteinbrinkDec 14, 2009
  7. Jason KingDec 14, 2009
  8. Björn SteinbrinkDec 15, 2009
  9. Andreas SchwabDec 15, 2009
  10. Andreas SchwabDec 16, 2009
  11. Fwd: am fails to apply patches for files with CRLF lineendingsBrandon Casey, Dec 15, 2009
  12. Sverre RabbelierDec 15, 2009
  13. Brandon CaseyDec 15, 2009
  14. Andreas SchwabDec 15, 2009
  15. Junio C HamanoDec 15, 2009
  16. Brandon CaseyDec 15, 2009
  17. Brandon CaseyJan 5, 2010
  18. Jason KingFeb 13, 2010

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.