pre-commit hook for CR LF checking
Ville M. Vainio
vivainio at gmail.com
Thu Feb 28 22:28:18 GMT 2008
On Thu, Feb 28, 2008 at 11:43 PM, Sabin Iacob <iacobs at m0n5t3r.info> wrote:
> I disagree; while some windows software may grok \n-only line endings,
> it's rather due to graceful error handling than "supporting" them; and
> then, what about source code (and/or text files) that are intended for a
> windows-only audience? why force them to convert back and forth between
> dos and unix line endings?
The target of this would be programmers - I figure that any
programming environment worth its salt supports LF.
> > I'm not talking about making it a default behaviour - I'm talking
> > about making it as easy as possible for new users to create that
> > setup, perhaps on some howto/cookbook page.
>
> making it default behaviour would be totally unacceptable; others' view
> of the world may be different from yours, and I, for one, would
> certainly not like this.
It still makes sense to provide a "best practices" plugin, that you
can just drop into place without delwing into the matter of authoring
plugins. Hg solves this thing with filters, so it would make certain
sense if bzr produced at least some kind of out-of-the-box solution
for this quite real issue. And it would be an extremely cheap
solution, in terms of developer time.
> the above being said, there is information about writing hooks at
> http://bazaar-vcs.org/WritingPlugins#invoking-plugin-functions-in-callbacks;
> the contents of a hook function could be as simple as:
>
> import os
> os.system('grep -rP "\r\n" .')
The actual content of hook function is of course trivial, though I'd
rather go for
if '\r\n' in open(file,'b').read()
COMPLAIN!!!
--
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
More information about the bazaar
mailing list