line-ending conversion (was Re: Bazaar as Subversion replacement)

Martin Pool mbp at canonical.com
Wed Jan 17 05:02:15 GMT 2007


On 16 Jan 2007, Alexander Belchenko <bialix at ukr.net> wrote:
> Marius Gedminas пишет:
> > On Tue, Jan 16, 2007 at 10:09:04PM +0200, Alexander Belchenko wrote:
> >> Don't understand me wrong.
> >> I know that reading files from disk and writing them back is the simplest
> >> part of line-endings support. I realize that proper support requires also
> >> new inventory format to store file type and all other stuff, that Aaron
> >> already mention in this thread.
> >> So it's looks very simple from user point of view, but I'm aware about
> >> underwater body of iceberg.
> > 
> > If .bzrignore at the root of the branch is enough to support ignored
> > files, wouldn't .bzrlineendings suffice for specifying which files need
> > what sort of line endings?
> > 
> >   *.py = native
> >   *.bat = CRLF
> >   *.sh = LF
> >   subdir/somesortofexception.sh = binary

That kind of approach seems to me to make more sense than per-file
properties.  In svn, it is easy for people to forget to set the right
property on a file, and then that revision will always be wrong.
And this is precisely the sort of feature which we want to have work
correctly even when most of the users don't understand it or know it
exists, and in most trees a small number of globs will do.

John alluded to the danger of

 * = native

and then checking in a binary file such as an image.  As a safety
feature we could noisily refuse to do conversion on files that look like
binaries (contain \0 etc).

> Support of such configuration file also discussed and I'm agree this file
> is needed.

> > If the number of per-branch configurable options is going to be larger,
> > maybe it is time to consider a .bzrbranch.cfg with sections, e.g.
> > something like
> > 
> >   [ignore]
> >   *.py
> >   *.svn
> > 
> >   [eol-style]
> >   *.py = native

I think for now I would keep them separate.

Some people would prefer no (or at least minimal) vcs cruft in the tree,
with these files inside .bzr or as special hidden properties.  But I
think we can go ahead with regular files for now.

> Here I'm not agree: *.py should be LF-only, otherwise shebangs does not works properly
> on Linux.

But lf-only is the native format on linux...

I agree you will get trouble if you check out on Windows and then try to
run the file on Linux.

-- 
Martin



More information about the bazaar mailing list