[darcs-users] Re: Line endings opinion poll (with bonus option)
schaffner at gmx.li
Tue Nov 2 19:34:25 UTC 2004
Igor Bukanov wrote:
> Ideally I would like darcs to
> accept all 3 line endings, \r\n, \n and \r
Please, let's let '\r' die a peaceful death. I've had my share of
problems with it, and automatic conversions.
Kannan Goundan wrote:
> 1. Hunk patches can specify their line-ending. This can be done by
> - Keeping the line endings on the '+' hunk entries.
This is the current behaviour:
Example on Unix:
before: " line1 \n line2",
after: " lineA \n lineB ",
patch: "- line1 \n- line 2 \n+ line A \n+ lineB "
Same example on Windows:
before: " line1 \r\n line2",
after: " lineA \r\n lineB ",
patch: "- line1 \r\n- line 2 \n+ line A \r\n+ lineB "
> - Always using '\n', but specifying the line-endings at the top of
> the hunk.
> 2. When Darcs modifies a working copy of an existing (non-empty)
> file, it should detect the line ending of the working copy and
> preserve it.
* Does not work for mixed-endings files.
* What if the ending is already "wrong"?
> 3. When Darcs has to add content to a new file (or add to an empty
> one), it has to decide what line-ending to use.
If I want to add a line to file foo.c, then the patch for this will
look different depending on which platform I did "darcs get" to
checkout the repo on which I work.
> This preference
> setting can be one of:
> Patch - Use same line-endings as the latest hunk patch.
The orders with which I pull from the repos will therefore matter,
which is against darcs' philosophy
> I think that this will minimize the chances that Darcs will change
> the line-ending format on you.
It is still there, I still have to worry about it.
Now, for some constructive criticism:
If a line-ending feature is desired, then IMO it should be as simple as
How about a single --using-dos-line-endings option for all relevant
commands, that is disabled by default, can be added to
_darcs/prefs/defaults, and does:
* Turn '\n' into '\r\n' when adding lines from patches into working
* Turn '\r\n' into '\n' when creating patches from working
This way, DOS-line-ending-utilites-using users could enable this
option, knowing about its potential problems, and the user interface
complexity of darcs (as well as the implementation complexity) is
increased by a minimum.
Maybe this option should even be enabled by default for the windows
build, so Hacker Hal does not get annoyed by Newbie Ned's carriage
return characters, but then again, this would require a second
> BTW, Visual Studio seems to allow mixing both types of line-endings
> in a single file. If you open up a Unix file, change some lines, and
> save it, all the unmodified lines will be Unix and the modified ones
> will be DOS. Not sure if Darcs should handle this or not
This is no problem for darcs.
> (Vim doesn't).
The version of vi that comes with Mac OS X 10.3.5 has no problem
either: it even adds the same new newlines as the ones it finds
$ vi --version
VIM - Vi IMproved 6.2 [...] +linebreak [...]
More information about the darcs-users