[PATCH] using .gitignore file should use glob as default syntax

Ben Kehoe benk at berkeley.edu
Tue Feb 5 15:44:38 CST 2013


Thanks! I appreciate the feedback.

On Tue, Feb 5, 2013 at 1:41 PM, Kevin Bullock <
kbullock+mercurial at ringworld.org> wrote:

> On Feb 5, 2013, at 2:55 PM, Ben Kehoe wrote:
>
> > # HG changeset patch
> > # User Ben Kehoe <benk at berkeley.edu>
> > # Date 1359580170 28800
> > # Node ID 0b5ff522049db893f4d1afb2030cd721f8e17761
> > # Parent  1516d5624a2911fcb90ee051c6dc0679b49aef55
> > using .gitignore file should use glob as default syntax
> >
> > .gitignore files use glob syntax instead of regexp.
> > When a repo is configured to use a custom ignore file named .gitignore,
> it
> > should be parsed using relglob syntax. This is implemented by adding a
> > default syntax parameter to ignorepats(), which when passed as None keeps
> > the current behavior. In readpats(), files named exactly '.gitignore'
> pass
> > 'relglob' to ingorepats() as the default syntax.
> > Tests are added to verify the behavior.
> > This patch will work in concert with a patch to hg-git to automatically
> use
> > the .gitignore file if it exists.
>
> I think this is unwise. gitignore[1] glob syntax and semantics are
> different from hgignore[2]. In particular, gitignore globs are relative to
> the .gitignore file (which also needn't be at the repo root!); globs in
> hgignore aren't rooted to anything.
>
> [1]: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
> [2]: http://www.selenic.com/hg/help/ignore
>
> This also isn't what the ui.ignore config option is intended for; it's
> meant to specify per-*user* ignore files. Mercurial doesn't provide a way
> for you to specify an alternate ignore file for a *repository* -- and using
> ui.ignore to do this will lead you to pain when you forget to configure it
> on one of your clones.
>
> What would be better is a hunk of code to automatically convert a
> .gitignore file into an .hgignore file. (I've been wanting this for a
> while, probably for the same reasons you wrote this patch.)
>
> pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
> Kevin R. Bullock
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130205/17b08ed7/attachment.html>


More information about the Mercurial-devel mailing list