@@ -48,7 +48,8 @@ struct cached_dir {
4848static enum path_treatment read_directory_recursive (struct dir_struct * dir ,
4949 const char * path , int len , struct untracked_cache_dir * untracked ,
5050 int check_only , const struct pathspec * pathspec );
51- static int get_dtype (struct dirent * de , const char * path , int len );
51+ static int get_dtype (struct dirent * de , struct index_state * istate ,
52+ const char * path , int len );
5253
5354int fspathcmp (const char * a , const char * b )
5455{
@@ -975,7 +976,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
975976
976977 if (x -> flags & EXC_FLAG_MUSTBEDIR ) {
977978 if (* dtype == DT_UNKNOWN )
978- * dtype = get_dtype (NULL , pathname , pathlen );
979+ * dtype = get_dtype (NULL , & the_index , pathname , pathlen );
979980 if (* dtype != DT_DIR )
980981 continue ;
981982 }
@@ -1459,12 +1460,13 @@ static int exclude_matches_pathspec(const char *path, int pathlen,
14591460 return 0 ;
14601461}
14611462
1462- static int get_index_dtype (const char * path , int len )
1463+ static int get_index_dtype (struct index_state * istate ,
1464+ const char * path , int len )
14631465{
14641466 int pos ;
14651467 const struct cache_entry * ce ;
14661468
1467- ce = index_file_exists (& the_index , path , len , 0 );
1469+ ce = index_file_exists (istate , path , len , 0 );
14681470 if (ce ) {
14691471 if (!ce_uptodate (ce ))
14701472 return DT_UNKNOWN ;
@@ -1478,12 +1480,12 @@ static int get_index_dtype(const char *path, int len)
14781480 }
14791481
14801482 /* Try to look it up as a directory */
1481- pos = index_name_pos (& the_index , path , len );
1483+ pos = index_name_pos (istate , path , len );
14821484 if (pos >= 0 )
14831485 return DT_UNKNOWN ;
14841486 pos = - pos - 1 ;
1485- while (pos < the_index . cache_nr ) {
1486- ce = the_index . cache [pos ++ ];
1487+ while (pos < istate -> cache_nr ) {
1488+ ce = istate -> cache [pos ++ ];
14871489 if (strncmp (ce -> name , path , len ))
14881490 break ;
14891491 if (ce -> name [len ] > '/' )
@@ -1497,14 +1499,15 @@ static int get_index_dtype(const char *path, int len)
14971499 return DT_UNKNOWN ;
14981500}
14991501
1500- static int get_dtype (struct dirent * de , const char * path , int len )
1502+ static int get_dtype (struct dirent * de , struct index_state * istate ,
1503+ const char * path , int len )
15011504{
15021505 int dtype = de ? DTYPE (de ) : DT_UNKNOWN ;
15031506 struct stat st ;
15041507
15051508 if (dtype != DT_UNKNOWN )
15061509 return dtype ;
1507- dtype = get_index_dtype (path , len );
1510+ dtype = get_index_dtype (istate , path , len );
15081511 if (dtype != DT_UNKNOWN )
15091512 return dtype ;
15101513 if (lstat (path , & st ))
@@ -1529,7 +1532,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
15291532 int has_path_in_index = !!index_file_exists (& the_index , path -> buf , path -> len , ignore_case );
15301533
15311534 if (dtype == DT_UNKNOWN )
1532- dtype = get_dtype (de , path -> buf , path -> len );
1535+ dtype = get_dtype (de , & the_index , path -> buf , path -> len );
15331536
15341537 /* Always exclude indexed files */
15351538 if (dtype != DT_DIR && has_path_in_index )
0 commit comments