git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin Ballard <kevin@sb.org>
To: Maaartin <grajcar1@seznam.cz>
Cc: git@vger.kernel.org
Subject: Re: [PROPOSAL] .gitignore syntax modification
Date: Fri, 8 Oct 2010 17:03:10 -0700	[thread overview]
Message-ID: <FD4E6D0A-34E6-4FC4-AA7A-327E07AB58D4@sb.org> (raw)
In-Reply-To: <loom.20101008T234354-493@post.gmane.org>

On Oct 8, 2010, at 2:58 PM, Maaartin wrote:

> You don't. You can do something like
> 
> *.xcodeproj/*
> !.xcodeproj/subdir_with_project
> .xcodeproj/subdir_with_project/*
> !.xcodeproj/subdir_with_project/*.pbxproj
> 
> I'm a beginner but I just stumbled upon this very problem five minutes ago.

That's not the right layout. I'd have to do

*.xcodeproj/*
!*.xcodeproj/project.pbxproj
*/*.xcodeproj/*
!*/*.xcodeproj/project.pbxproj

And so on, once for each possible level of nesting.

> The reason for git ignoring everything in the directory without ever looking 
> there is efficiency.

That's not what's happening either. That happens if you ignore the directory itself, such as

*.xcodeproj/

That won't look in the directory at all to match non-ignore patterns. The problem I'm talking about is simply that you cannot write a pattern that includes a slash and have that pattern match at any nesting level.

Upon further reflection, if we stick with platform-provided fnmatch() we don't have to special-case a prefixed **/. We could simply define patterns as always matching in that way, and you can use the already-existing prefixed / to root it at the current level. So if my pattern looks like

*.xcodeproj/*

Then it will attempt to match this pattern against the last 2 path components of any path rooted in this directory. It can simply count the slashes to determine the number of path components. If I really want it to just match *.xcodeproj files in the current directory then my pattern should look like

/*.xcodeproj/*

-Kevin Ballard

  reply	other threads:[~2010-10-09  0:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-08 21:26 [PROPOSAL] .gitignore syntax modification Kevin Ballard
2010-10-08 21:58 ` Maaartin
2010-10-09  0:03   ` Kevin Ballard [this message]
2010-10-11 23:46     ` Maaartin
2010-10-13  2:24 ` Nguyen Thai Ngoc Duy
2010-10-13  2:32   ` Kevin Ballard
2010-10-13  2:40     ` Jonathan Nieder
2010-10-13  3:05       ` Kevin Ballard
2010-10-13 16:51         ` Junio C Hamano
2010-10-13 12:15     ` Nguyen Thai Ngoc Duy
2010-10-15 11:01       ` Kevin Ballard
2010-10-15 12:57         ` Nguyen Thai Ngoc Duy
2010-10-15 20:15           ` Kevin Ballard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FD4E6D0A-34E6-4FC4-AA7A-327E07AB58D4@sb.org \
    --to=kevin@sb.org \
    --cc=git@vger.kernel.org \
    --cc=grajcar1@seznam.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).