# git 1.7.10.msysgit.1: different behaviour in ".gitignore" and ".git/info/exclude"

3 messages from 2012-05-30 to 2012-05-30. Participants: Thomas Wichern, Johannes Sixt.
Thread: https://gitlist.dev/t/30650

## Thomas Wichern, 2012-05-30 08:43

Subject: git 1.7.10.msysgit.1: different behaviour in ".gitignore" and ".git/info/exclude"
Message-ID: <96434119.20120530104356@gmx.de>
URL: https://gitlist.dev/e/96434119.20120530104356%40gmx.de

```
Hi,

I noticed the following difference when using the pattern "/(*)/"
(ignore all directories where the name is enclosed in parenthesis)

If you have a ".gitignore" - file that contains the pattern "/(*)/", a
directory that matches the pattern is ignored completely.

If you put the same pattern into the ".git/info/exclude" - file, the
pattern does not work - these directories still show up.

I expected that all directories anywhere the repository that match the
pattern to be ignored.

Am I doing something wrong? Is the pattern not correct?

Horrido,
Thomas

---
git version 1.7.10.msysgit.1
Windows 7 Pro

```

## Johannes Sixt, 2012-05-30 10:28

Subject: Re: git 1.7.10.msysgit.1: different behaviour in ".gitignore" and ".git/info/exclude"
Message-ID: <4FC5F661.6090105@viscovery.net>
URL: https://gitlist.dev/e/4FC5F661.6090105%40viscovery.net
In-Reply-To: <96434119.20120530104356@gmx.de>

```
Am 5/30/2012 10:43, schrieb Thomas Wichern:
> If you have a ".gitignore" - file that contains the pattern "/(*)/", a
> directory that matches the pattern is ignored completely.
> 
> If you put the same pattern into the ".git/info/exclude" - file, the
> pattern does not work - these directories still show up.
> 
> I expected that all directories anywhere the repository that match the
> pattern to be ignored.

The first slash in the pattern means: Match only in this directory, not in
subdirectories. For patterns in .git/info/exclude, "this directory" is the
top-level of the repository.

> Am I doing something wrong? Is the pattern not correct?

Perhaps you need "(*)/", i.e., without the first slash.

-- Hannes

```

## Thomas Wichern, 2012-05-30 10:52

Subject: Re: git 1.7.10.msysgit.1: different behaviour in ".gitignore" and ".git/info/exclude"
Message-ID: <799289647.20120530125233@gmx.de>
URL: https://gitlist.dev/e/799289647.20120530125233%40gmx.de
In-Reply-To: <4FC5F661.6090105@viscovery.net>

```
Hi Hannes,

thanks a lot - it was my fault and you're right.
It works with "(*)/" very well!

Horrido,
Thomas


> Am 5/30/2012 10:43, schrieb Thomas Wichern:
>> If you have a ".gitignore" - file that contains the pattern "/(*)/", a
>> directory that matches the pattern is ignored completely.
>> 
>> If you put the same pattern into the ".git/info/exclude" - file, the
>> pattern does not work - these directories still show up.
>> 
>> I expected that all directories anywhere the repository that match the
>> pattern to be ignored.

> The first slash in the pattern means: Match only in this directory, not in
> subdirectories. For patterns in .git/info/exclude, "this directory" is the
> top-level of the repository.

>> Am I doing something wrong? Is the pattern not correct?

> Perhaps you need "(*)/", i.e., without the first slash.

> -- Hannes

```
