Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perforce changed line endings

Tags:

perforce

I had a project on Mac and uploaded it to a perforce server. When I got the project from PC all the line endings were changed and now it does not compile on PC. Is there a way to automatically change the line endings like they were before or I must submit again all the project from Windows? Is there any way to make perforce to keep my files AS THEY ARE? I really don't want to have stupid modifications in my source files.

Thanks!

EDIT:

It has to do with perforce, I just edited 10-20 files on MAC to make a multiplatform project to compile. The rest of 140k files were not changed and not even opened on Mac(they were opened by compiler to compile them:P). If I copy the project on PC the line endings are ok.

like image 474
Mircea Ispas Avatar asked Apr 14 '11 13:04

Mircea Ispas


2 Answers

Yes you can. Using Unix line-endings for both your clients will tell the perforce clients to leave the files unchanged from how they were submitted. You can also setup a trigger on the server to force it this way, refer to my answer to this question:

Setting Perforce line endings

like image 21
Craig Avatar answered Nov 12 '22 07:11

Craig


Line endings for text files are controlled by your client spec setting. You need to make sure that your client's 'LineEnd' value is set properly. In general, this should be left to 'local' which should do the right thing for whatever operating system you are using.

That said, depending on how this value was set on your Mac when you originally uploaded the files, I suppose that there could possibly be some problem when syncing those files to your PC.

I would check to make sure that LineEnd is set to 'local' for your clients. There is a note on the Perforce Knowledge Base site here that talks more in depth about proper settings for Macintosh clients. That might be a place to start as well to make sure that you have things properly configured on your Macintosh.

like image 69
Mark Avatar answered Nov 12 '22 06:11

Mark