git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter <vmail@mycircuit.org>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: git@vger.kernel.org
Subject: Re: gitignore: how to exclude a directory tree from being ignored
Date: Thu, 01 Oct 2009 16:48:05 +0200	[thread overview]
Message-ID: <4AC4C125.10609@mycircuit.org> (raw)
In-Reply-To: <4AC4AD25.5010708@viscovery.net>


>> 1) I can't have just one .gitignore file in the root dir, if I want to
>> _recursively_ inverse the exclude pattern for a sub dir tree.
>>     
>
> No, it's not the inversion of the pattern, but the slash (if it is not at
> the end) that makes the pattern non-recursive.
>
>   
from the gitignore manpage:
 >> If the pattern ends with a slash, it is removed for the purpose of 
the following description, but it would only find a match with a 
directory. In other words, foo/ will match a directory foo and paths 
underneath it, but will not match a regular file or a symbolic link foo 
(this is consistent with the way how pathspec works in general in git). <<

Doesn't this mean, that if I say:
vendor/
matches the directory and ( recursively ) the paths underneath it.?
And, consequently:
!vendor/
inverse the exclusion for vendor ( that is: include ) and everything 
that is contained in it ? ( This is obviously not the case, but this is 
what I would expect )

>> In this case, I have to put individual .gitignore files in the sub trees
>> I want to re-include.
>>     
>
> If you have only the directory vendor/ with no further interesting
> subdirectories, then you can use my first suggestion. But if you have your
> *.exe and *.o distributed over several directories of different depths
> below vendor/, then it might be easier to have a separate
> vendor/.gitignore with recursive patterns (i.e. that do not contain a slash).
>
>   
This works for me ( I have indeed distributed them over several dirs )
>> 2) In order to see what will be staged, I have to use the :
>> git ls-files -o --exclude-standard
>> instead of :
>> git ls-files -o -i --exclude-from=.gitignore
>> because the latter won't consider .gitignore patterns in subtree
>>     
>
> After reading the documentation, I don't know, and I won't try now ;-)
>
>   
At least it seams to work here ..
> -- Hannes
>   
Thanks !

  reply	other threads:[~2009-10-01 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 11:07 gitignore: how to exclude a directory tree from being ignored Peter
2009-10-01 12:39 ` Johannes Sixt
2009-10-01 13:00   ` Peter
2009-10-01 13:22     ` Johannes Sixt
2009-10-01 14:48       ` Peter [this message]
2009-10-01 15:25         ` Johannes Sixt
2009-10-01 16:26           ` Peter

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=4AC4C125.10609@mycircuit.org \
    --to=vmail@mycircuit.org \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /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).