git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tommy Thorn <tommy-git@thorn.ws>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: Re: Bug in .gitignore handling
Date: Wed, 26 Mar 2008 13:35:57 -0700	[thread overview]
Message-ID: <47EAB3AD.5070507@thorn.ws> (raw)
In-Reply-To: <alpine.LFD.1.00.0803261324380.2775@woody.linux-foundation.org>

Linus Torvalds wrote:
> On Wed, 26 Mar 2008, Tommy Thorn wrote:
>   
>> My desperate attempts "./foo" and "^foo" also didn't work. Please note that
>> this is a vastly simplified version of the real problem, so I can't just use
>> "!mousetrap/foo".
>>
>> It seems "foo/" _should_ work even though foo isn't a directory.
>>     
>
> Close but no cigar.
>
> Use "/foo" and it should be ok.
>
> Basically, a path with a slash in it is considered absolute, but if the 
> slash is at the end it will only match a directory. A slash at the 
> *beginning* will match the root of the git repository, though.

D'oh, of course that works. I double check the documentation and it 
actually isn't obvious that that is allowed, so I propose this patch.

Tommy


 From c0a003e995e325d5d9e056137b4b02c370c9dc03 Mon Sep 17 00:00:00 2001
From: Tommy Thorn <tommy-git@thorn.ws>
Date: Wed, 26 Mar 2008 13:34:34 -0700
Subject: [PATCH] Documentation/gitginore.txt: Be explicit about the /foo 
form

Signed-off-by: Tommy Thorn <tommy-git@thorn.ws>
---
 Documentation/gitignore.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index e847b3b..941a8a4 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -57,6 +57,9 @@ Patterns have the following format:
    included again.  If a negated pattern matches, this will
    override lower precedence patterns sources.
 
+ - If the pattern begins with a slash '/', the pattern will only
+   match in the current directory.
+
  - 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
-- 
1.5.5.rc1

  parent reply	other threads:[~2008-03-26 20:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 20:01 Bug in .gitignore handling Tommy Thorn
2008-03-26 20:20 ` Junio C Hamano
2008-03-26 20:26   ` Tommy Thorn
2008-03-26 20:27 ` Linus Torvalds
2008-03-26 20:32   ` Linus Torvalds
2008-03-26 20:35   ` Tommy Thorn [this message]
2008-03-26 20:49     ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2008-03-26 20:27 Eyvind Bernhardsen

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=47EAB3AD.5070507@thorn.ws \
    --to=tommy-git@thorn.ws \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.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).