[p4] line endings

Qazwart qazwart at gmail.com
Tue Aug 14 21:56:22 PDT 2007


On Aug 14, 2007, at 3:43 PM, Ivey, William wrote:
>> If this is the case, then Perforce should always be
>> normalizing each file before checking in and out, and
>> sending the files to your client with the correct line
>> endings.
>
> There is no such thing as a "normal" text file. On any
> given system, Unix or Windows, there can be some of each
> (and some Mac files, etc.).


That's the reason I said "normalizing" instead of what type of file  
it should be. If a file is a text file, and the normal way that the  
file is stored on that system is with CR/LF line endings, then when a  
TEXT file is checked in, whatever line endings are used, they should  
be translated to the line endings that machine uses. If I checkout a  
file, the line endings should "convert" (if necessary) to the line  
endings that are normal on my machine.

In a source control system, all files are considered "text" unless  
there is a reason to consider them otherwise. I can only think of two:
Heuristic evidence on the file suggests it is not pure text (i.e.  
contains characters other than the around 90 text characters), and  
the file itself is marked as a binary file.

I've used Subversion, and I know that it seems to handle the line  
ending situation much better.

> The problem, in my experience, arises from user
> inconsistency. People pass files around from systems of
> one flavor to another. People change their client's
> line ending setting then submit without refreshing the
> sync file. Some people just decide to change the text
> format because they have no clue it matteres. People
> ignore my warnings - a LOT.

Nothing you stated should cause a problem (the emphasis on SHOULD).  
When a file is submitted, the server should scan and replace any  
necessary line endings unless the file is marked as binary. This  
should happen no matter what line endings are used in your file, or  
whatever line endings you client is using.

--
David Weintraub
david at weintraub.name
qazwart at gmail.com




More information about the perforce-user mailing list