On Sunday, October 31, 2004 7:06 AM, Igor Bukanov wrote:
> > What would the correct line ending be for a repo that's on a
> > drive that you mount from Unix as well as from Windows?
>
> As it was already pointed out, there are 2 cases to consider:
>
> 1) New text goes to the _darcs repository. Ideally I would like darcs to
> accept all 3 line endings, \r\n, \n and \r even if they are mixed in the
> single text file. That is darcs should split the text file into lines
> and work with logical lines and not their physical presentation.
> Internally the lines can be separated by \n but that is OK since if
> somebody wishes to edit stored patch files, then the person can deal
> with line ending there as well.
I'll second that. The only catch would be if someone needed to have a \r in
the middle of a line, although I can't conceive of a situation where that
would be desirable. (additionally, it would only be possible on UNIX, and
darcs seems to default to settings that are platform-independant).
> 2) Darcs generates text output from the context of _darcs repository. In
> this case it would nice IMO if there is a flag to specify a particular
> line ending for the working files and patches which defaults to platform
> specific line ending or existing file context. That is, for new files or
> output to stdout darcs should use this flag while for the existing files
> the present line endings should be preserved.
I'm imagining that darcs would read the file into logical lines, apply the
patches, then write them back out using encoding X.
If you wanted to preserve the encoding, you'd have to analyze the lines as
you read them to figure out what encoding they use. Then remember that flag
for when you write it again.
I'd almost rather it just always write using the repo-specified encoding,
since its less code to write. But, I guess I wouldn't mind either way.
-Mike
|