Re: [BUG] git am sometimes unable to apply git format-patch output file
- Date: Sat, 12 Aug 2017 19:01:36 +0200
- From: Torsten Bögershausen <tboegi@xxxxxx>
- Subject: Re: [BUG] git am sometimes unable to apply git format-patch output file
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
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