git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Maaartin <grajcar1@seznam.cz>
To: git@vger.kernel.org
Subject: Re: [PROPOSAL] .gitignore syntax modification
Date: Fri, 8 Oct 2010 21:58:59 +0000 (UTC)	[thread overview]
Message-ID: <loom.20101008T234354-493@post.gmane.org> (raw)
In-Reply-To: 113B4C41-ECDA-479D-A281-DF6ACDFE8FBB@sb.org

Kevin Ballard <kevin <at> sb.org> writes:

> ... Similarly, for foo.xcodeproj packages I
> like to ignore all contained files except project.pbxproj. 
Unfortunately, .gitignore has no good way of
> matching this sort of thing at anything other than the root level. Here's an 
example of my global
> ~/.gitignore file:
> 
> *.xcodeproj/*
> !*.xcodeproj/*.pbxproj
> 
> ... On any repository where this isn't the case, I have to duplicate this 
pattern into
> a .gitignore file at the right level.

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.

The reason for git ignoring everything in the directory without ever looking 
there is efficiency. Maybe we would need something like "weak ignore" meaning 
ignore all matching files but traverse the directories. I'd propose the syntax

?*.xcodeproj
!*.pbxproj

for this. The pattern after the question would exclude all files below 
*.xcodeproj but still traverse the directories there. The second pattern would 
re-include the *.pbxproj files.

The lower efficiency would be no problem, since this was user's choice not to 
use the standard pattern. You could still prevent digging too deep by using 
additionally something like

*.xcodeproj/*/*

  reply	other threads:[~2010-10-08 21:59 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 [this message]
2010-10-09  0:03   ` Kevin Ballard
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=loom.20101008T234354-493@post.gmane.org \
    --to=grajcar1@seznam.cz \
    --cc=git@vger.kernel.org \
    /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).