# [BUG?] read_directory(), core.ignorecase and pathspec

3 messages from 2011-05-12 to 2011-05-13. Participants: Nguyen Thai Ngoc Duy, Junio C Hamano.
Thread: https://gitlist.dev/t/27338

## Nguyen Thai Ngoc Duy, 2011-05-12 13:24

Subject: [BUG?] read_directory(), core.ignorecase and pathspec
Message-ID: <BANLkTimqJvLoWGxMzeSs9n7LrrLaE-azwQ@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTimqJvLoWGxMzeSs9n7LrrLaE-azwQ%40mail.gmail.com

```
I was looking at how read_directory() uses pathspec, and it seems that
simplify_away(), the function that cuts out directories early if
they're definitely outside given pathspec, does exact match (ie.
memcmp) regardless core.ignorecase. This means "git add -- '*.c'" may
not work as expected when core.ignorecase is on.

I haven't tested it though. Just heads up. If you care about
core.ignorecase (I don't apparently), you can try it out.

The whole simplifying thing in read_directory() will eventually be
replaced with real pathspec matching as we put more magic in pathspec.
-- 
Duy

```

## Junio C Hamano, 2011-05-12 16:04

Subject: Re: [BUG?] read_directory(), core.ignorecase and pathspec
Message-ID: <7vwrhvdhwg.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwrhvdhwg.fsf%40alter.siamese.dyndns.org
In-Reply-To: <BANLkTimqJvLoWGxMzeSs9n7LrrLaE-azwQ@mail.gmail.com>

```
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:

> I was looking at how read_directory() uses pathspec, and it seems that
> simplify_away(), the function that cuts out directories early if
> they're definitely outside given pathspec, does exact match (ie.
> memcmp) regardless core.ignorecase. This means "git add -- '*.c'" may
> not work as expected when core.ignorecase is on.

I don't think for '*.c' it would make any difference, but it is very
plausible that 'frotz/*.c' will cull 'Frotz/anything' as "never going to
match".

> The whole simplifying thing in read_directory() will eventually be
> replaced with real pathspec matching as we put more magic in pathspec.

That should be done not "as" but "before". Get the foundation right before
going fancier.

```

## Nguyen Thai Ngoc Duy, 2011-05-13 00:39

Subject: Re: [BUG?] read_directory(), core.ignorecase and pathspec
Message-ID: <BANLkTimZuzj0o57TOnp8ftnqXse=nRv8HQ@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTimZuzj0o57TOnp8ftnqXse%3DnRv8HQ%40mail.gmail.com
In-Reply-To: <7vwrhvdhwg.fsf@alter.siamese.dyndns.org>

```
On Thu, May 12, 2011 at 11:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
>> I was looking at how read_directory() uses pathspec, and it seems that
>> simplify_away(), the function that cuts out directories early if
>> they're definitely outside given pathspec, does exact match (ie.
>> memcmp) regardless core.ignorecase. This means "git add -- '*.c'" may
>> not work as expected when core.ignorecase is on.
>
> I don't think for '*.c' it would make any difference, but it is very
> plausible that 'frotz/*.c' will cull 'Frotz/anything' as "never going to
> match".

Right, it only checks prefix.

>> The whole simplifying thing in read_directory() will eventually be
>> replaced with real pathspec matching as we put more magic in pathspec.
>
> That should be done not "as" but "before". Get the foundation right before
> going fancier.
>

Right, again.
-- 
Duy

```
