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

Re: [BUG] git am sometimes unable to apply git format-patch output file

From
STSoul Trace <s-trace@list.ru>
Date
Aug 16, 2017, 07:45 UTC
Message-ID
<71432224-5ec4-7f48-7e9f-c0a69a75efad@list.ru>
In-Reply-To
<20170812170136.GB21045@tor.lan>
12.08.2017 20:01, Torsten Bögershausen пишет:
Show 37 quoted lines
> On Sat, Aug 12, 2017 at 06:20:23PM +0200, Torsten Bögershausen wrote:
>> On Sat, Aug 12, 2017 at 07:02:59PM +0300, Soul Trace wrote:
>>> Hello.
>>>
>>> Using git i have found that git am command may sometimes fail to apply patch
>>> file which was created by the git am command.
>>>
>>>
>>> Steps to reproduce:
>> Excellent, thanks so much for the detailed bug report.
>> This kind of information is really appreciated.
>>
>> Why did I say excellent ?
>> Because I am working on a patch, which -should- fix exactly this kind of issues.
>> I send out a patch earlier this day, but it doesn't fix your issue, even if it should.
>> I hope to have a fix soonish.
> I need to correct mysef, a litte bit, this doesn't seem to be a bug, but a feature.
> There are 2 things to be noticed:
> - The xml file has been commited with CRLF
> - git am strips the CR (because they -may- have been added by a mail program)
>
> There are 2 different solutions:
> a) Use git am --keep-cr
> b) "Normalize" the xml file(s), and commit them to have LF in the repo,
>      they can still have CRLF in the work tree, if needed.
>      This is done by
>      echo "*.xml text" >>.gitattributes
>      touch *.xml
>      git add *.xml .gitattributes
>      git commit -m "Normalize xml files"
>
>
> If you really need the xml files with CRLF, use this line instead:
>      echo "*.xml eol=CRLF" >>.gitattributes
>
> HTH
> /Torsten
Thank you.

I will use a) the solution, because I use git am to apply custom patches to the Android tree from vendorsetup.sh in my device tree at ". build/envsetup.sh" execution and just want git to apply commits what I did earlier, when the upstream repositories changes (instead of forking the upstream repositories, and then merge the upstream changes to the end of the world).

Thanks for your answer, it's really useful. Good luck in patching your issue!

Previous: Torsten Bögershausen
Message 4 of 4 in “[BUG] git am sometimes unable to apply git format-patch output file”
  1. Soul TraceAug 12, 2017
  2. Torsten BögershausenAug 12, 2017
  3. Torsten BögershausenAug 12, 2017
  4. Soul TraceAug 16, 2017

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.