Problems with WinSCP with end-of-line style on Ubuntu Linux when using SVN Diff
Asked Answered
A

7

6

My files are on a remote Ubuntu Linux server. When I download the files and edit it in either the WinSCP text editor or Notepad++, the file end-of-line style changes to Windows. So when I resave the file back to Ubuntu the lines are off and SVN Diff thinks every line has changed.

FYI, I edit the file by double clicking the file in WinSCP. This program launches the file in the editor. Every time I save, the file is automatically copied back to the Linux server.

How do I prevent the end-of-line style issue?

Arson answered 27/12, 2009 at 23:18 Comment(3)
do you mean newlines instead of whitespaces ? Do you have a unix newlines compatible editor, or at least, is it configured to autodetect newlines and act accordingly ?Ladyinwaiting
I am not sure if its newlines or whitespaces. You might be right, it may be newlines. How do you change the default editor to be newlines compatible editor? I can use notepad++.Arson
I tried changing the file to use unix EOL character in notepad++ but the SVN diff still thought every line changedArson
A
2

I wasn't able to figure out why I had the whitespace issue but I was able to figure out how to ignore whitespaces.

You can use:

svn diff -x'-uw --ignore-eol-style'

This worked well enough.

Arson answered 23/7, 2010 at 18:59 Comment(1)
You're actually ignoring line-endings, so your're not solving your original issue.Tribunal
I
3

Does this thread help? More precisely this part:

From this, it seems to me that you have forced WinSCP to use text mode transfer, which imply the unix->dos conversion. Just force the binary mode to avoid the conversion.

Ingles answered 27/12, 2009 at 23:32 Comment(1)
This didn't work for me. It also didn't work for the person on the thread also from what I can tell.Arson
A
2

I wasn't able to figure out why I had the whitespace issue but I was able to figure out how to ignore whitespaces.

You can use:

svn diff -x'-uw --ignore-eol-style'

This worked well enough.

Arson answered 23/7, 2010 at 18:59 Comment(1)
You're actually ignoring line-endings, so your're not solving your original issue.Tribunal
S
1

You need to use the unix line format. To set this, go to Settings>Preferences and select the "New Documents/Default Directory" tab. Find "Format" in the "New Document" controls and select "Unix". This will ensure any new document has the correct format. I have used this with a remote linux server and have not seen a problem.

Typically, the returned file would be created with a temporary name and the changes written to it. The original file would then be removed and the new file renamed to take its place. This would make the returned file a "new" document so this preference setting should give the correct format.

Shitty answered 7/12, 2011 at 20:15 Comment(0)
A
1

The simple and appropriate fix to that issue can be done by going into the configuration of your external editor in WinSCP

In: View > Preferences > Editors

Select your external editor and click Edit ...

Then, uncheck: Force text transfer mode for files edited in external editor

Auriga answered 6/7, 2016 at 4:39 Comment(0)
A
0

If you use text/ascii mode transfer with WinSCP, it would convert the end-of-line style back to Unix on upload.

So I guess the problem might be that your file actually has Windows end-of-line style initially. On download, nothing changes, but on upload, it gets converted to Unix style.

Either fix your file to use the Unix style as it should (if that's the case) or use the binary transfer mode.

Not only you need to configure the binary transfer mode for WinSCP in general (what is the default in recent versions of WinSCP), but you also need to make sure that the preference option Force text transfer mode for files edited in external editor for your external editor (Notepad++) is off:
https://winscp.net/eng/docs/ui_editor_preferences

Note that this option is not available for WinSCP internal editor. With it files are always transferred in the text/ascii mode.

Aplanospore answered 13/6, 2014 at 7:43 Comment(0)
W
0

I use Notepand2 and WinSCP to edit files on Windows and server is on Linux.

In my case the problem was with WinSCP connection itself.

I clicked "Edit" before the connection and then "Advanced" there was option for End-of-line characters. Changing it solved the problem in my case.

Option on the screen is already the one that worked. Ealier there was "LF" only.

enter image description here

Wagoner answered 16/7, 2015 at 13:29 Comment(0)
R
0

This a supplement to Djidiouf's answer.

  1. Go to WinSCP(ver.5.17.9) Options->Preferences->Editors
    Uncheck Force test transfer mode for files edited in external editor Uncheck Force test transfer mode for files edited in external editor

  2. Go to Session->Advanced->Environment->End-of-line characters
    Select LF LF should be selected

  3. Trying to pull a file from server, verifying its EOL-sytle notepad++

Recipience answered 7/1, 2022 at 18:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.