File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ int git_attr_file__parse_buffer(
347
347
{
348
348
const char * scan = data , * context = NULL ;
349
349
git_attr_rule * rule = NULL ;
350
- int error = 0 ;
350
+ int ignorecase = 0 , error = 0 ;
351
351
352
352
/* If subdir file path, convert context for file paths */
353
353
if (attrs -> entry && git_fs_path_root (attrs -> entry -> path ) < 0 &&
@@ -379,6 +379,13 @@ int git_attr_file__parse_buffer(
379
379
continue ;
380
380
}
381
381
382
+ if (repo &&
383
+ (error = git_repository__configmap_lookup (& ignorecase , repo , GIT_CONFIGMAP_IGNORECASE )) < 0 )
384
+ goto out ;
385
+
386
+ if (ignorecase )
387
+ rule -> match .flags |= GIT_ATTR_FNMATCH_ICASE ;
388
+
382
389
if (rule -> match .flags & GIT_ATTR_FNMATCH_MACRO ) {
383
390
/* TODO: warning if macro found in file below repo root */
384
391
if (!allow_macros )
@@ -482,7 +489,7 @@ bool git_attr_fnmatch__match(
482
489
*/
483
490
if (match -> containing_dir ) {
484
491
if (match -> flags & GIT_ATTR_FNMATCH_ICASE ) {
485
- if (git__strncasecmp (path -> path , match -> containing_dir , match -> containing_dir_length ))
492
+ if (git__prefixcmp_icase (path -> path , match -> containing_dir ))
486
493
return 0 ;
487
494
} else {
488
495
if (git__prefixcmp (path -> path , match -> containing_dir ))
Original file line number Diff line number Diff line change @@ -53,6 +53,18 @@ void test_filter_query__filters(void)
53
53
cl_assert_equal_i (1 , filter_for ("id.binident" , "ident" ));
54
54
}
55
55
56
+ void test_filter_query__filters_ignorecase (void )
57
+ {
58
+ if (!cl_repo_get_bool (g_repo , "core.ignorecase" ))
59
+ cl_skip ();
60
+
61
+ cl_assert_equal_i (1 , filter_for ("TEXT.TXT" , "crlf" ));
62
+ cl_assert_equal_i (0 , filter_for ("Binary.bin" , "crlf" ));
63
+
64
+ cl_assert_equal_i (1 , filter_for ("id.Ident" , "crlf" ));
65
+ cl_assert_equal_i (1 , filter_for ("ID.IdEnT" , "ident" ));
66
+ }
67
+
56
68
void test_filter_query__autocrlf_true_implies_crlf (void )
57
69
{
58
70
cl_repo_set_bool (g_repo , "core.autocrlf" , true);
You can’t perform that action at this time.
0 commit comments