77 * Copyright (C) Linus Torvalds, 2005-2006
88 * Junio Hamano, 2005-2006
99 */
10+ #define NO_THE_INDEX_COMPATIBILITY_MACROS
1011#include "cache.h"
1112#include "dir.h"
1213#include "attr.h"
@@ -596,20 +597,20 @@ static void *read_skip_worktree_file_from_index(const char *path, size_t *size,
596597 void * data ;
597598
598599 len = strlen (path );
599- pos = cache_name_pos ( path , len );
600+ pos = index_name_pos ( & the_index , path , len );
600601 if (pos < 0 )
601602 return NULL ;
602- if (!ce_skip_worktree (active_cache [pos ]))
603+ if (!ce_skip_worktree (the_index . cache [pos ]))
603604 return NULL ;
604- data = read_sha1_file (active_cache [pos ]-> oid .hash , & type , & sz );
605+ data = read_sha1_file (the_index . cache [pos ]-> oid .hash , & type , & sz );
605606 if (!data || type != OBJ_BLOB ) {
606607 free (data );
607608 return NULL ;
608609 }
609610 * size = xsize_t (sz );
610611 if (sha1_stat ) {
611612 memset (& sha1_stat -> stat , 0 , sizeof (sha1_stat -> stat ));
612- hashcpy (sha1_stat -> sha1 , active_cache [pos ]-> oid .hash );
613+ hashcpy (sha1_stat -> sha1 , the_index . cache [pos ]-> oid .hash );
613614 }
614615 return data ;
615616}
@@ -785,12 +786,12 @@ static int add_excludes(const char *fname, const char *base, int baselen,
785786 !match_stat_data_racy (& the_index , & sha1_stat -> stat , & st ))
786787 ; /* no content change, ss->sha1 still good */
787788 else if (check_index &&
788- (pos = cache_name_pos ( fname , strlen (fname ))) >= 0 &&
789- !ce_stage (active_cache [pos ]) &&
790- ce_uptodate (active_cache [pos ]) &&
789+ (pos = index_name_pos ( & the_index , fname , strlen (fname ))) >= 0 &&
790+ !ce_stage (the_index . cache [pos ]) &&
791+ ce_uptodate (the_index . cache [pos ]) &&
791792 !would_convert_to_git (fname ))
792793 hashcpy (sha1_stat -> sha1 ,
793- active_cache [pos ]-> oid .hash );
794+ the_index . cache [pos ]-> oid .hash );
794795 else
795796 hash_sha1_file (buf , size , "blob" , sha1_stat -> sha1 );
796797 fill_stat_data (& sha1_stat -> stat , & st );
@@ -1235,7 +1236,7 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
12351236
12361237static struct dir_entry * dir_add_name (struct dir_struct * dir , const char * pathname , int len )
12371238{
1238- if (cache_file_exists ( pathname , len , ignore_case ))
1239+ if (index_file_exists ( & the_index , pathname , len , ignore_case ))
12391240 return NULL ;
12401241
12411242 ALLOC_GROW (dir -> entries , dir -> nr + 1 , dir -> alloc );
@@ -1244,7 +1245,7 @@ static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathna
12441245
12451246struct dir_entry * dir_add_ignored (struct dir_struct * dir , const char * pathname , int len )
12461247{
1247- if (!cache_name_is_other ( pathname , len ))
1248+ if (!index_name_is_other ( & the_index , pathname , len ))
12481249 return NULL ;
12491250
12501251 ALLOC_GROW (dir -> ignored , dir -> ignored_nr + 1 , dir -> ignored_alloc );
@@ -1266,10 +1267,10 @@ static enum exist_status directory_exists_in_index_icase(const char *dirname, in
12661267{
12671268 struct cache_entry * ce ;
12681269
1269- if (cache_dir_exists ( dirname , len ))
1270+ if (index_dir_exists ( & the_index , dirname , len ))
12701271 return index_directory ;
12711272
1272- ce = cache_file_exists ( dirname , len , ignore_case );
1273+ ce = index_file_exists ( & the_index , dirname , len , ignore_case );
12731274 if (ce && S_ISGITLINK (ce -> ce_mode ))
12741275 return index_gitdir ;
12751276
@@ -1290,11 +1291,11 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
12901291 if (ignore_case )
12911292 return directory_exists_in_index_icase (dirname , len );
12921293
1293- pos = cache_name_pos ( dirname , len );
1294+ pos = index_name_pos ( & the_index , dirname , len );
12941295 if (pos < 0 )
12951296 pos = - pos - 1 ;
1296- while (pos < active_nr ) {
1297- const struct cache_entry * ce = active_cache [pos ++ ];
1297+ while (pos < the_index . cache_nr ) {
1298+ const struct cache_entry * ce = the_index . cache [pos ++ ];
12981299 unsigned char endchar ;
12991300
13001301 if (strncmp (ce -> name , dirname , len ))
@@ -1460,7 +1461,7 @@ static int get_index_dtype(const char *path, int len)
14601461 int pos ;
14611462 const struct cache_entry * ce ;
14621463
1463- ce = cache_file_exists ( path , len , 0 );
1464+ ce = index_file_exists ( & the_index , path , len , 0 );
14641465 if (ce ) {
14651466 if (!ce_uptodate (ce ))
14661467 return DT_UNKNOWN ;
@@ -1474,12 +1475,12 @@ static int get_index_dtype(const char *path, int len)
14741475 }
14751476
14761477 /* Try to look it up as a directory */
1477- pos = cache_name_pos ( path , len );
1478+ pos = index_name_pos ( & the_index , path , len );
14781479 if (pos >= 0 )
14791480 return DT_UNKNOWN ;
14801481 pos = - pos - 1 ;
1481- while (pos < active_nr ) {
1482- ce = active_cache [pos ++ ];
1482+ while (pos < the_index . cache_nr ) {
1483+ ce = the_index . cache [pos ++ ];
14831484 if (strncmp (ce -> name , path , len ))
14841485 break ;
14851486 if (ce -> name [len ] > '/' )
@@ -1522,7 +1523,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
15221523 int dtype , struct dirent * de )
15231524{
15241525 int exclude ;
1525- int has_path_in_index = !!cache_file_exists ( path -> buf , path -> len , ignore_case );
1526+ int has_path_in_index = !!index_file_exists ( & the_index , path -> buf , path -> len , ignore_case );
15261527
15271528 if (dtype == DT_UNKNOWN )
15281529 dtype = get_dtype (de , path -> buf , path -> len );
0 commit comments