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
JKJason King <jk@silentcow.com>
Date
Dec 14, 2009, 21:16 UTC
Message-ID
<B86FC676-FEAE-482D-953D-701A01FD2877@silentcow.com>
In-Reply-To
<20091214205517.GA1317@atjola.homenet>
On Dec 14, 2009, at 12:55 PM, Björn Steinbrink wrote:
Show 44 quoted lines
> On 2009.12.14 12:38:30 -0800, Jason King wrote:
>> 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.

Sure, it won't affect LFers at all if you test the header lines of the patch file - we'll be immune from that conversion then. Works for me :)

Thanks again, Jason

Previous: Björn SteinbrinkNext: Björn Steinbrink
Message 7 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.