[Mono-list] newline and cvs

Martin Baulig martin@gnome.org
03 Mar 2002 15:52:55 +0100


Paolo Molaro <lupus@ximian.com> writes:

> To anyone who has write access to the cvs repository:
> 
> 	DO NOT CHANGE THE NEWLINE CONVENTION OF EXISTING FILES
> 
> Unix and DOS use different conventions for line separators:
> \n for Unix and \r\n for DOS (ok, \r for the mac, too).
> Currently some files in the class library use \n and some use \r\n;
> this is not a problem per se, but I agree it would be good to be
> consistent about it for _new_ files (I suggest the unix convention).

If you're using Emacs to edit the files, you can use

        // -*- mode: csharp; coding: dos -*-

or

        // -*- mode: csharp; coding: unix -*-

at the top of the file, and you can edit the file as much as you like -
Emacs will automatically save it in the correct coding system.

> However, existing files should *not* be changed to match the convention
> used by the last programmer that committed to the file! This makes the
> cvs history useless and reviewing patches almost impossible.
> So, use an editor that doesn't change the newline convention and review
> your patches before committing for errors like this (you should check
> the diff anyway before committing).

A good way to catch such problems is using cvs diff -uw in your working
tree, applying the output as a patch to a newly checked out copy, then
doing another cvs diff -u (without the -w) there, checking the result and
them committing.

-- 
Martin Baulig
martin@gnome.org