# [PATCH] Add case insensitive support in matching pathspec

7 messages from 2011-02-03 to 2011-02-05. Participants: Nguyễn Thái Ngọc Duy, Johannes Sixt, Junio C Hamano, Nguyen Thai Ngoc Duy.
Thread: https://gitlist.dev/t/26401

## Nguyễn Thái Ngọc Duy, 2011-02-03 16:38

Subject: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <1296751106-15316-1-git-send-email-pclouds@gmail.com>
URL: https://gitlist.dev/e/1296751106-15316-1-git-send-email-pclouds%40gmail.com

```
Commit 21444f1 (Add case insensitivity support when using git ls-files
- 2010-10-03) teaches match_pathspec() to ignore case when
core.ignorecase=true.

match_pathspec_depth() is developed independently and does not have
this feature. Teach it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 On top of nd/struct-pathspec, but requires jj/icase-directory. I can
 rebase the series on top of master if it causes too many conflicts.

 dir.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dir.c b/dir.c
index b1407a5..2597f81 100644
--- a/dir.c
+++ b/dir.c
@@ -192,7 +192,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
 	if (!*match)
 		return MATCHED_RECURSIVELY;
 
-	if (matchlen <= namelen && !strncmp(match, name, matchlen)) {
+	if (matchlen <= namelen && !strncmp_icase(match, name, matchlen)) {
 		if (matchlen == namelen)
 			return MATCHED_EXACTLY;
 
@@ -200,7 +200,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
 			return MATCHED_RECURSIVELY;
 	}
 
-	if (item->has_wildcard && !fnmatch(match, name, 0))
+	if (item->has_wildcard && !fnmatch_icase(match, name, 0))
 		return MATCHED_FNMATCH;
 
 	return 0;
-- 
1.7.2.2

```

## Johannes Sixt, 2011-02-03 20:17

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <201102032117.32745.j6t@kdbg.org>
URL: https://gitlist.dev/e/201102032117.32745.j6t%40kdbg.org
In-Reply-To: <1296751106-15316-1-git-send-email-pclouds@gmail.com>

```
On Donnerstag, 3. Februar 2011, Nguyễn Thái Ngọc Duy wrote:
> Commit 21444f1 (Add case insensitivity support when using git ls-files
> - 2010-10-03) teaches match_pathspec() to ignore case when
> core.ignorecase=true.
>
> match_pathspec_depth() is developed independently and does not have
> this feature. Teach it.

Is match_pathspec_depth() used to match names of files on the filesystem, or 
names of files in the index or in the repository?

core.ignorecase should be honored only when files on the filesystem are 
matched, IMO.

-- Hannes

```

## Junio C Hamano, 2011-02-03 22:14

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <7vwrlgzryj.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwrlgzryj.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1296751106-15316-1-git-send-email-pclouds@gmail.com>

```
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

>  On top of nd/struct-pathspec, but requires jj/icase-directory. I can
>  rebase the series on top of master if it causes too many conflicts.

I am in the middle of rewinding 'next' and have already rebased the topic;
I will queue the result in 'pu' so could you check the result when it is
pushed out later?

```

## Nguyen Thai Ngoc Duy, 2011-02-04 13:00

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <AANLkTi=8-NibvV0NMCpA_KN6+x3GNa0mDr87jtWki_-S@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3D8-NibvV0NMCpA_KN6%2Bx3GNa0mDr87jtWki_-S%40mail.gmail.com
In-Reply-To: <201102032117.32745.j6t@kdbg.org>

```
2011/2/4 Johannes Sixt <j6t@kdbg.org>:
> On Donnerstag, 3. Februar 2011, Nguyễn Thái Ngọc Duy wrote:
>> Commit 21444f1 (Add case insensitivity support when using git ls-files
>> - 2010-10-03) teaches match_pathspec() to ignore case when
>> core.ignorecase=true.
>>
>> match_pathspec_depth() is developed independently and does not have
>> this feature. Teach it.
>
> Is match_pathspec_depth() used to match names of files on the filesystem, or
> names of files in the index or in the repository?
>
> core.ignorecase should be honored only when files on the filesystem are
> matched, IMO.

Names in index, just as same as match_pathspec().
-- 
Duy

```

## Junio C Hamano, 2011-02-04 23:06

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <7vei7nxuw5.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vei7nxuw5.fsf%40alter.siamese.dyndns.org
In-Reply-To: <AANLkTi=8-NibvV0NMCpA_KN6+x3GNa0mDr87jtWki_-S@mail.gmail.com>

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

>> core.ignorecase should be honored only when files on the filesystem are
>> matched, IMO.
>
> Names in index, just as same as match_pathspec().

If the matched entities are names in the index, they should already be
canonical and we shouldn't be matching with icase, no?

```

## Nguyen Thai Ngoc Duy, 2011-02-05 04:14

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <AANLkTi=5j1kjAjY6ek6YXTs24DO9J7X0QQjTB4qrZ_g3@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3D5j1kjAjY6ek6YXTs24DO9J7X0QQjTB4qrZ_g3%40mail.gmail.com
In-Reply-To: <7vei7nxuw5.fsf@alter.siamese.dyndns.org>

```
On Sat, Feb 5, 2011 at 6:06 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
>>> core.ignorecase should be honored only when files on the filesystem are
>>> matched, IMO.
>>
>> Names in index, just as same as match_pathspec().
>
> If the matched entities are names in the index, they should already be
> canonical and we shouldn't be matching with icase, no?

The patterns are case-insensitive. The example given in 21444f is "git
ls-files mydir" should also match MyDir/* in index. Although by
modifying match_one(), it affects more than just git-ls-files. I'm not
the original author, so Joshua, was that patch to fix git-ls-files
only?
-- 
Duy

```

## Nguyen Thai Ngoc Duy, 2011-02-05 07:44

Subject: Re: [PATCH] Add case insensitive support in matching pathspec
Message-ID: <AANLkTi=F3KYEJK6UuvUvqmwEx7kiyd_WP20rUvir2K=b@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DF3KYEJK6UuvUvqmwEx7kiyd_WP20rUvir2K%3Db%40mail.gmail.com
In-Reply-To: <7vwrlgzryj.fsf@alter.siamese.dyndns.org>

```
2011/2/4 Junio C Hamano <gitster@pobox.com>:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>>  On top of nd/struct-pathspec, but requires jj/icase-directory. I can
>>  rebase the series on top of master if it causes too many conflicts.
>
> I am in the middle of rewinding 'next' and have already rebased the topic;
> I will queue the result in 'pu' so could you check the result when it is
> pushed out later?

Checked. Looks good to me.
-- 
Duy

```
