git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [ENHANCEMENT] Allow '**' pattern in .gitignore
@ 2012-10-02  7:21 Ramkumar Ramachandra
  2012-10-02  7:58 ` Stefano Lattarini
  0 siblings, 1 reply; 9+ messages in thread
From: Ramkumar Ramachandra @ 2012-10-02  7:21 UTC (permalink / raw)
  To: Git List

Hi,

I've often found the '**' (extended) shell glob useful for matching
any string crossing directory boundaries: it's especially useful if
you only have a toplevel .gitignore, as opposed to a per-directory
.gitignore.  Unfortunately, .gitignore currently uses fnmatch(3), and
doesn't recognize '**'.  Would extending the .gitignore format to
accept this be a useful feature?  Would it involve re-implementing and
extending fnmatch, or is there some other way?

Ram

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-02  7:21 [ENHANCEMENT] Allow '**' pattern in .gitignore Ramkumar Ramachandra
@ 2012-10-02  7:58 ` Stefano Lattarini
  2012-10-02  8:24   ` Ramkumar Ramachandra
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Lattarini @ 2012-10-02  7:58 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

On 10/02/2012 09:21 AM, Ramkumar Ramachandra wrote:
> Hi,
> 
> I've often found the '**' (extended) shell glob useful for matching
> any string crossing directory boundaries: it's especially useful if
> you only have a toplevel .gitignore, as opposed to a per-directory
> .gitignore.  Unfortunately, .gitignore currently uses fnmatch(3), and
> doesn't recognize '**'.  Would extending the .gitignore format to
> accept this be a useful feature?  Would it involve re-implementing and
> extending fnmatch, or is there some other way?
>
I think there is a topic in flight about this:

    <http://thread.gmane.org/gmane.comp.version-control.git/206406>

HTH,
  Stefano

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-02  7:58 ` Stefano Lattarini
@ 2012-10-02  8:24   ` Ramkumar Ramachandra
  2012-10-03 11:35     ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 9+ messages in thread
From: Ramkumar Ramachandra @ 2012-10-02  8:24 UTC (permalink / raw)
  To: Stefano Lattarini; +Cc: Git List

Stefano Lattarini wrote:
> On 10/02/2012 09:21 AM, Ramkumar Ramachandra wrote:
>> Hi,
>>
>> I've often found the '**' (extended) shell glob useful for matching
>> any string crossing directory boundaries: it's especially useful if
>> you only have a toplevel .gitignore, as opposed to a per-directory
>> .gitignore.  Unfortunately, .gitignore currently uses fnmatch(3), and
>> doesn't recognize '**'.  Would extending the .gitignore format to
>> accept this be a useful feature?  Would it involve re-implementing and
>> extending fnmatch, or is there some other way?
>>
> I think there is a topic in flight about this:
>
>     <http://thread.gmane.org/gmane.comp.version-control.git/206406>

Ah, yes.  Thanks.

Ram

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-02  8:24   ` Ramkumar Ramachandra
@ 2012-10-03 11:35     ` Nguyen Thai Ngoc Duy
  2012-10-03 13:35       ` Jens Lehmann
  0 siblings, 1 reply; 9+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-10-03 11:35 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Stefano Lattarini, Git List

On Tue, Oct 2, 2012 at 3:24 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> Stefano Lattarini wrote:
>> On 10/02/2012 09:21 AM, Ramkumar Ramachandra wrote:
>>> Hi,
>>>
>>> I've often found the '**' (extended) shell glob useful for matching
>>> any string crossing directory boundaries: it's especially useful if
>>> you only have a toplevel .gitignore, as opposed to a per-directory
>>> .gitignore.  Unfortunately, .gitignore currently uses fnmatch(3), and
>>> doesn't recognize '**'.  Would extending the .gitignore format to
>>> accept this be a useful feature?  Would it involve re-implementing and
>>> extending fnmatch, or is there some other way?
>>>
>> I think there is a topic in flight about this:
>>
>>     <http://thread.gmane.org/gmane.comp.version-control.git/206406>

While I'm behind this series, I have no use cases for it in my
repositories. It's tested in git test suite but that's about it. Some
feedback would be nice, especially on the performance side if you do a
lot of ignores.
-- 
Duy

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-03 11:35     ` Nguyen Thai Ngoc Duy
@ 2012-10-03 13:35       ` Jens Lehmann
  2012-10-03 13:42         ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 9+ messages in thread
From: Jens Lehmann @ 2012-10-03 13:35 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Ramkumar Ramachandra, Stefano Lattarini, Git List

Am 03.10.2012 13:35, schrieb Nguyen Thai Ngoc Duy:
> On Tue, Oct 2, 2012 at 3:24 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>> Stefano Lattarini wrote:
>>> On 10/02/2012 09:21 AM, Ramkumar Ramachandra wrote:
>>>> Hi,
>>>>
>>>> I've often found the '**' (extended) shell glob useful for matching
>>>> any string crossing directory boundaries: it's especially useful if
>>>> you only have a toplevel .gitignore, as opposed to a per-directory
>>>> .gitignore.  Unfortunately, .gitignore currently uses fnmatch(3), and
>>>> doesn't recognize '**'.  Would extending the .gitignore format to
>>>> accept this be a useful feature?  Would it involve re-implementing and
>>>> extending fnmatch, or is there some other way?
>>>>
>>> I think there is a topic in flight about this:
>>>
>>>     <http://thread.gmane.org/gmane.comp.version-control.git/206406>
> 
> While I'm behind this series, I have no use cases for it in my
> repositories. It's tested in git test suite but that's about it. Some
> feedback would be nice, especially on the performance side if you do a
> lot of ignores.

I really like it as we do have use cases at my dayjob. Due to our
naming conventions in subdirectories we have stuff like this in our
.gitignore files:

*/foo/bar
*/*/foo/bar
*/*/*/foo/bar

Using "**/foo/bar" instead would be a great improvement (I looked
into adding that myself some time ago, but decided it wasn't a low
hanging fruit).

Maybe I'll find time do do some performance measurements until the
weekend, what numbers are you interested in? Will a hot cache "time
git status" be sufficient or are you interested in other numbers too?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-03 13:35       ` Jens Lehmann
@ 2012-10-03 13:42         ` Nguyen Thai Ngoc Duy
  2012-10-03 13:51           ` Jens Lehmann
  2012-10-03 17:51           ` Joshua Jensen
  0 siblings, 2 replies; 9+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-10-03 13:42 UTC (permalink / raw)
  To: Jens Lehmann; +Cc: Ramkumar Ramachandra, Stefano Lattarini, Git List

On Wed, Oct 3, 2012 at 8:35 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
> */foo/bar
> */*/foo/bar
> */*/*/foo/bar
>
> Using "**/foo/bar" instead would be a great improvement

If this "**/foo/bar" (i.e. no wildcards except one ** at the
beginning) is popular, we could optimize this case, turning fmatch()
into strncmp(), just like what we do for "foobar*"
-- 
Duy

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-03 13:42         ` Nguyen Thai Ngoc Duy
@ 2012-10-03 13:51           ` Jens Lehmann
  2012-10-03 17:51           ` Joshua Jensen
  1 sibling, 0 replies; 9+ messages in thread
From: Jens Lehmann @ 2012-10-03 13:51 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Ramkumar Ramachandra, Stefano Lattarini, Git List

Am 03.10.2012 15:42, schrieb Nguyen Thai Ngoc Duy:
> On Wed, Oct 3, 2012 at 8:35 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
>> */foo/bar
>> */*/foo/bar
>> */*/*/foo/bar
>>
>> Using "**/foo/bar" instead would be a great improvement
> 
> If this "**/foo/bar" (i.e. no wildcards except one ** at the
> beginning) is popular, we could optimize this case, turning fmatch()
> into strncmp(), just like what we do for "foobar*"

I expect the logic "ignore <pattern including a slash> in any
directory depth you find it" to be one of the major use cases for
"**", so I think optimization makes sense here.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-03 13:42         ` Nguyen Thai Ngoc Duy
  2012-10-03 13:51           ` Jens Lehmann
@ 2012-10-03 17:51           ` Joshua Jensen
  2012-10-04  1:34             ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 9+ messages in thread
From: Joshua Jensen @ 2012-10-03 17:51 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy
  Cc: Jens Lehmann, Ramkumar Ramachandra, Stefano Lattarini, Git List

----- Original Message -----
From: Nguyen Thai Ngoc Duy
Date: 10/3/2012 7:42 AM
> On Wed, Oct 3, 2012 at 8:35 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
>> */foo/bar
>> */*/foo/bar
>> */*/*/foo/bar
>>
>> Using "**/foo/bar" instead would be a great improvement
> If this "**/foo/bar" (i.e. no wildcards except one ** at the
> beginning) is popular, we could optimize this case, turning fmatch()
> into strncmp(), just like what we do for "foobar*"
FWIW, I would like to see this in .gitattributes as well.  I have a 
version of .gitattributes that supports recursive wildcards that I use 
for specifying filters.

-Josh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ENHANCEMENT] Allow '**' pattern in .gitignore
  2012-10-03 17:51           ` Joshua Jensen
@ 2012-10-04  1:34             ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 9+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-10-04  1:34 UTC (permalink / raw)
  To: Joshua Jensen
  Cc: Jens Lehmann, Ramkumar Ramachandra, Stefano Lattarini, Git List

On Thu, Oct 4, 2012 at 12:51 AM, Joshua Jensen
<jjensen@workspacewhiz.com> wrote:
> FWIW, I would like to see this in .gitattributes as well.  I have a version
> of .gitattributes that supports recursive wildcards that I use for
> specifying filters.

.gitattributes also learns about "**" in nd/wildmatch topic.
-- 
Duy

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-10-04 21:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02  7:21 [ENHANCEMENT] Allow '**' pattern in .gitignore Ramkumar Ramachandra
2012-10-02  7:58 ` Stefano Lattarini
2012-10-02  8:24   ` Ramkumar Ramachandra
2012-10-03 11:35     ` Nguyen Thai Ngoc Duy
2012-10-03 13:35       ` Jens Lehmann
2012-10-03 13:42         ` Nguyen Thai Ngoc Duy
2012-10-03 13:51           ` Jens Lehmann
2012-10-03 17:51           ` Joshua Jensen
2012-10-04  1:34             ` Nguyen Thai Ngoc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).