git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kai Schlamp <schlamp@gmx.de>
To: git@vger.kernel.org
Subject: Re: Beginner problem with .gitignore
Date: Tue, 21 Apr 2009 14:26:14 +0200	[thread overview]
Message-ID: <gske1o$bnf$1@ger.gmane.org> (raw)
In-Reply-To: <49EDB167.1030600@drmicha.warpmail.net>

  > The problem is the recursive way in which git applies those patterns.
> Your patterns above mean that git never recurses into the subdirs.
> 
> In the example above, you probably want
> 
> /a_dir/b_dir/*
> !/a_dir/b_dir/c_dir/

Ok, I see. But that way would not ignore other directories in a_dir 
beside b_dir. For that task I have to use the following in .gitignore:

/a_dir/*
!/a_dir/b_dir/
/a_dir/b_dir/*
!/a_dir/b_dir/c_dir/

This tends to a quite bloated .gitignore when you have a deep directory 
structure and don't want to ignore all subfolders.
I also took a brief look into Mercurial and in my opinion the .hgignore 
is more straightforward. It seems to use regexp on the complete file 
path to find out if the files that should be ignored. So the above four 
lines can be combined to one (and if the directory structure would be 
deeper, it would also be just a one liner).
I know that there for sure is a reason for why git uses it's pattern in 
.gitignore (probably a performance thing). But it would be nice to have 
at least an option that it recurses into subdiretories, or uses regexp 
syntax on the whole file path. Just my two cents.

Best regards,
Kai

      reply	other threads:[~2009-04-21 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 17:57 Beginner problem with .gitignore Kai Schlamp
2009-04-21  8:51 ` Michael J Gruber
2009-04-21  9:57   ` Kai Schlamp
2009-04-21 11:43     ` Michael J Gruber
2009-04-21 12:26       ` Kai Schlamp [this message]

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

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

  git send-email \
    --in-reply-to='gske1o$bnf$1@ger.gmane.org' \
    --to=schlamp@gmx.de \
    --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.
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 NNTP newsgroup(s).