[darcs-users] problem with files without trailing newlines

David Roundy droundy at abridgegame.org
Wed Nov 26 14:19:07 UTC 2003


There's a problem with darcs' treatment of files that don't end in a
newline--it treates such a file as if it *did* end in a newline, which
isn't really what you want.  This problem has been there for a while.  It
started when I used to use the haskell library functions lines and unlines
to break a file file into lines.  There are inverse functions, except when
the file doesn't end in a newline.

The problem has been that changing how darcs breaks files into newlines
breaks compatibility, so I didn't want to do it.  I've now decided that now
is the time to break compatibility, and I also realized that it won't be as
bad as I feared.

Tomorrow (or maybe the day after...) I'll push a patch to make this change.
This will introduce corruption into the repo... I'll update the
convert-repo program to fix this.  However, there will still be a change of
your repository, which will be that every file will have a newline stripped
off the end of it.  Your working directory won't be affected, so you
probably will want to make sure whatsnew shows no changes, then upgrade
darcs, then convert-repo, and then record a patch adding all the newlines
back again.

I've tried to think of a nicer backwards-compatible way of fixing things,
but wasn't able to come up with anything that wasn't hideously ugly.  Once
this process is over, darcs will deal with the issue of files lacking
trailing newlines very nicely--the trailing newline is represented by an
empty line at the end of the file.

If anyone has darcs repos that they think will be affected by this change,
or has any questions about it, let me know.  I think the right time to do
this is now, as we're making the repository format transition (the patch
filename transition).  That way people only have to worry about running
convert-repo once.  Hopefully when this is over I won't have to break
compatibility again.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list