0

I have some python code managed with GIT and developed in Spyder (all on windows 7, python 2.7.10, winpython). Somehow the code is broken since a few days and when opening files in Spyder it tells me, that the file has mixed line endings, which are automatically corrected. This correction leads to the introduction of a newline after each line of code.

I basically have two questions:

  1. Where can such a mix-up stem from? To my best knowledge, the affected code has never been opened in another editor, on another plattform etc.
  2. How can I fix the files in a way they are still compatible with their GIT ancestors?
Dschoni
  • 3,714
  • 6
  • 45
  • 80
  • Did you active the git option that forces a particular line-ending for all files in your repo? – Carlos Cordoba May 23 '17 at 17:49
  • Not that I know of. Inside my git client or inside spyder? – Dschoni May 24 '17 at 11:34
  • Your git client. – Carlos Cordoba May 24 '17 at 13:42
  • You could be right. We recently updated our git client and didn't see the behaviour before. I'll investigate. – Dschoni May 24 '17 at 15:16
  • Ok, please let me know how that goes. My guess is that your git client is forcing Linux line endings in your repo, and (unfortunately) Spyder forces files to use the same line endings of your operating system (Windows in your case). I think this is an error in Spyder and we should fix it (I'm a Spyder developer). – Carlos Cordoba May 24 '17 at 19:41
  • I found the answer in my git-client's release notes. Gitkraken replaced CRLF with LF line endings sometimes when resolving merge conflicts. So, spyder sees that, tries to fix it and introduces newlines to be consistent is my guess? – Dschoni May 26 '17 at 07:28
  • Yes, if Spyder detects mixed line endings in a file then it rewrites all of them to be of one kind only (CLRF on Windows, for example). – Carlos Cordoba May 26 '17 at 13:14

0 Answers0