This is included in the cookbook because it seems that there are persons within the project that don't have the in-depth knowledge of CVS nor the interest or need to acquire it. For that reason some simple questions are answered here for use of CVS in the project.
Why do I get double lines? Why do I get ^M at the end of each line? Why do I get the whole checked out file on a single line?
CVS is line oriented. It stores in the repository the concept of a new line after each line. It is the CVS clients (the program you have installed on you machine) responsibility to convert the conceptual new line to the correct new line character on your system.
![]() | Note |
---|---|
This is only so for normal files (not marked with -kb in CVS). |
If files are moved from one system to another or for that matter checked out on one system and used and edited on another (NFS, SMB, ...) this is not done correctly. There could also be CVS clients out there, not doing this correctly.
Systems known to the author (Linus Tolke) are Unix uses LF, DOS/Windows uses CR-LF, Mac uses CR.
Most of the time this really doesn't matter because the editors and java compiler on all systems are very forgiving.
There are however some cases when this is cumbersome.
When an editor (or developer) decides to "fix-it".
This means that the editor (or the developer) goes through the file and removes ^M on every line or something else that touches every line in the file.
This is a problem because the subsequent commit will also touch every line in the file making that file unmergeable. This means that every developer that had it modified in a branch or in a checked out copy will have no help from CVS when doing his merging.
Remember that you never know what other developers are working with.
This is fixed by not doing any such fixes and doing a cvs diff before each check in so that your editor has not done this for you.
When CVS clients and file systems are not in sync
This could result in one of several things. Either each line gets an extra empty line when committed, or the whole file turns out to be on the same line.
This is the case on several files in the repository at the moment (August 2002, Linus) and can be cumbersome for the developers.
These cases should be fixed because the files are no longer readable. For the first case, removing every other line (the empty ones) can in some cases be done without CVS having problems with merging later on. For the second case, with a single long line, this will be very problematic so even though it might cause problems for other developers it is better to do this as soon as possible.
When this is fixed, let the fix be the only thing done in that commit.
To avoid this in the future, always do a cvs diff before doing your change to make sure that only the lines that you have actually modified will be changed by CVS and not the whole file.
Files that are binary that shall be stored in CVS shall be marked as binary. They are marked with the admin flag -kb. This means that the line ending conversion mechanism will not be applied on those files and they will be exactly the same on all systems. This is good for jars, GIFs, and other such files.