git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Git does not convert CRLF=>LF on files with \r not before \n
@ 2015-04-21 13:51 Alexandre Garnier
  2015-04-21 17:41 ` Junio C Hamano
  2015-04-21 19:28 ` Torsten Bögershausen
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandre Garnier @ 2015-04-21 13:51 UTC (permalink / raw)
  To: git

Here is a test:

git init -q crlf-test
cd crlf-test
echo '*       text=auto' > .gitattributes
git add .gitattributes
git commit -q -m "Normalize EOL"
echo -ne 'some content\r\nother \rcontent with CR\r\ncontent\r\nagain
content with\r\r\n' > inline-cr.txt
echo "Working directory content:"
cat -A inline-cr.txt
echo
git add inline-cr.txt
echo "Indexed content:"
git show :inline-cr.txt | cat -A

Result
------
File content:
some content^M$
other ^Mcontent with CR^M$
content^M$
again content with^M^M$

Indexed content:
some content^M$
other ^Mcontent with CR^M$
content^M$
again content with^M^M$

Expected result
---------------
File content:
some content^M$
other ^Mcontent with CR^M$
content^M$
again content with^M^M$

Indexed content:
some content$
other ^Mcontent with CR$
content$
again content with^M$
# or even 'again content with$' for this last line

If you remove the \r that are not at the end of the lines, EOL are
converted as expected:
File content:
some content^M$
other content with CR^M$
content^M$
again content with^M$

Indexed content:
some content$
other content with CR$
content$
again content with$

-- 
Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-22 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-21 13:51 [BUG] Git does not convert CRLF=>LF on files with \r not before \n Alexandre Garnier
2015-04-21 17:41 ` Junio C Hamano
2015-04-22 17:42   ` Junio C Hamano
2015-04-21 19:28 ` Torsten Bögershausen
2015-04-22 13:06   ` Alexandre Garnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).