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
Torsten Bögershausen <tboegi@web.de>
Date
Aug 12, 2017, 17:01 UTC
Message-ID
<20170812170136.GB21045@tor.lan>
In-Reply-To
<20170812162023.GA21045@tor.lan>
On Sat, Aug 12, 2017 at 06:20:23PM +0200, Torsten Bögershausen wrote:
Show 16 quoted lines
> 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

Previous: Torsten BögershausenNext: Soul Trace
Message 3 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.