@@ -53,6 +53,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
53
53
int check_only , const struct path_simplify * simplify );
54
54
static int get_dtype (struct dirent * de , const char * path , int len );
55
55
56
+ static struct trace_key trace_exclude = TRACE_KEY_INIT (EXCLUDE );
57
+
56
58
/* helper string functions with support for the ignore_case flag */
57
59
int strcmp_icase (const char * a , const char * b )
58
60
{
@@ -905,6 +907,8 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
905
907
if (!el -> nr )
906
908
return NULL ; /* undefined */
907
909
910
+ trace_printf_key (& trace_exclude , "exclude: from %s\n" , el -> src );
911
+
908
912
for (i = el -> nr - 1 ; 0 <= i ; i -- ) {
909
913
struct exclude * x = el -> excludes [i ];
910
914
const char * exclude = x -> pattern ;
@@ -936,6 +940,16 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
936
940
break ;
937
941
}
938
942
}
943
+
944
+ if (!exc ) {
945
+ trace_printf_key (& trace_exclude , "exclude: %.*s => n/a\n" ,
946
+ pathlen , pathname );
947
+ return NULL ;
948
+ }
949
+
950
+ trace_printf_key (& trace_exclude , "exclude: %.*s vs %s at line %d => %s\n" ,
951
+ pathlen , pathname , exc -> pattern , exc -> srcpos ,
952
+ exc -> flags & EXC_FLAG_NEGATIVE ? "no" : "yes" );
939
953
return exc ;
940
954
}
941
955
@@ -1683,9 +1697,13 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
1683
1697
struct cached_dir cdir ;
1684
1698
enum path_treatment state , subdir_state , dir_state = path_none ;
1685
1699
struct strbuf path = STRBUF_INIT ;
1700
+ static int level = 0 ;
1686
1701
1687
1702
strbuf_add (& path , base , baselen );
1688
1703
1704
+ trace_printf_key (& trace_exclude , "exclude: [%d] enter '%.*s'\n" ,
1705
+ level ++ , baselen , base );
1706
+
1689
1707
if (open_cached_dir (& cdir , dir , untracked , & path , check_only ))
1690
1708
goto out ;
1691
1709
@@ -1749,6 +1767,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
1749
1767
}
1750
1768
close_cached_dir (& cdir );
1751
1769
out :
1770
+ trace_printf_key (& trace_exclude , "exclude: [%d] leave '%.*s'\n" ,
1771
+ -- level , baselen , base );
1752
1772
strbuf_release (& path );
1753
1773
1754
1774
return dir_state ;
0 commit comments