git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add case insensitive support in matching pathspec
@ 2011-02-03 16:38 Nguyễn Thái Ngọc Duy
  2011-02-03 20:17 ` Johannes Sixt
  2011-02-03 22:14 ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2011-02-03 16:38 UTC (permalink / raw)
  To: git, Junio C Hamano, Joshua Jensen; +Cc: Nguyễn Thái Ngọc Duy

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-03 16:38 [PATCH] Add case insensitive support in matching pathspec Nguyễn Thái Ngọc Duy
@ 2011-02-03 20:17 ` Johannes Sixt
  2011-02-04 13:00   ` Nguyen Thai Ngoc Duy
  2011-02-03 22:14 ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2011-02-03 20:17 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Joshua Jensen

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-03 16:38 [PATCH] Add case insensitive support in matching pathspec Nguyễn Thái Ngọc Duy
  2011-02-03 20:17 ` Johannes Sixt
@ 2011-02-03 22:14 ` Junio C Hamano
  2011-02-05  7:44   ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2011-02-03 22:14 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Joshua Jensen

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-03 20:17 ` Johannes Sixt
@ 2011-02-04 13:00   ` Nguyen Thai Ngoc Duy
  2011-02-04 23:06     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-02-04 13:00 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, Junio C Hamano, Joshua Jensen

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-04 13:00   ` Nguyen Thai Ngoc Duy
@ 2011-02-04 23:06     ` Junio C Hamano
  2011-02-05  4:14       ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2011-02-04 23:06 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Johannes Sixt, git, Joshua Jensen

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-04 23:06     ` Junio C Hamano
@ 2011-02-05  4:14       ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 7+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-02-05  4:14 UTC (permalink / raw)
  To: Junio C Hamano, Joshua Jensen; +Cc: Johannes Sixt, git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add case insensitive support in matching pathspec
  2011-02-03 22:14 ` Junio C Hamano
@ 2011-02-05  7:44   ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 7+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-02-05  7:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-05  7:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 16:38 [PATCH] Add case insensitive support in matching pathspec Nguyễn Thái Ngọc Duy
2011-02-03 20:17 ` Johannes Sixt
2011-02-04 13:00   ` Nguyen Thai Ngoc Duy
2011-02-04 23:06     ` Junio C Hamano
2011-02-05  4:14       ` Nguyen Thai Ngoc Duy
2011-02-03 22:14 ` Junio C Hamano
2011-02-05  7:44   ` Nguyen Thai Ngoc Duy

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).