@@ -150,7 +150,7 @@ static int update_some(const struct object_id *oid, struct strbuf *base,
150150 */
151151 pos = cache_name_pos (ce -> name , ce -> ce_namelen );
152152 if (pos >= 0 ) {
153- struct cache_entry * old = active_cache [pos ];
153+ struct cache_entry * old = the_index . cache [pos ];
154154 if (ce -> ce_mode == old -> ce_mode &&
155155 !ce_intent_to_add (old ) &&
156156 oideq (& ce -> oid , & old -> oid )) {
@@ -179,18 +179,18 @@ static int read_tree_some(struct tree *tree, const struct pathspec *pathspec)
179179
180180static int skip_same_name (const struct cache_entry * ce , int pos )
181181{
182- while (++ pos < active_nr &&
183- !strcmp (active_cache [pos ]-> name , ce -> name ))
182+ while (++ pos < the_index . cache_nr &&
183+ !strcmp (the_index . cache [pos ]-> name , ce -> name ))
184184 ; /* skip */
185185 return pos ;
186186}
187187
188188static int check_stage (int stage , const struct cache_entry * ce , int pos ,
189189 int overlay_mode )
190190{
191- while (pos < active_nr &&
192- !strcmp (active_cache [pos ]-> name , ce -> name )) {
193- if (ce_stage (active_cache [pos ]) == stage )
191+ while (pos < the_index . cache_nr &&
192+ !strcmp (the_index . cache [pos ]-> name , ce -> name )) {
193+ if (ce_stage (the_index . cache [pos ]) == stage )
194194 return 0 ;
195195 pos ++ ;
196196 }
@@ -207,8 +207,8 @@ static int check_stages(unsigned stages, const struct cache_entry *ce, int pos)
207207 unsigned seen = 0 ;
208208 const char * name = ce -> name ;
209209
210- while (pos < active_nr ) {
211- ce = active_cache [pos ];
210+ while (pos < the_index . cache_nr ) {
211+ ce = the_index . cache [pos ];
212212 if (strcmp (name , ce -> name ))
213213 break ;
214214 seen |= (1 << ce_stage (ce ));
@@ -224,10 +224,10 @@ static int checkout_stage(int stage, const struct cache_entry *ce, int pos,
224224 const struct checkout * state , int * nr_checkouts ,
225225 int overlay_mode )
226226{
227- while (pos < active_nr &&
228- !strcmp (active_cache [pos ]-> name , ce -> name )) {
229- if (ce_stage (active_cache [pos ]) == stage )
230- return checkout_entry (active_cache [pos ], state ,
227+ while (pos < the_index . cache_nr &&
228+ !strcmp (the_index . cache [pos ]-> name , ce -> name )) {
229+ if (ce_stage (the_index . cache [pos ]) == stage )
230+ return checkout_entry (the_index . cache [pos ], state ,
231231 NULL , nr_checkouts );
232232 pos ++ ;
233233 }
@@ -244,7 +244,7 @@ static int checkout_stage(int stage, const struct cache_entry *ce, int pos,
244244static int checkout_merged (int pos , const struct checkout * state ,
245245 int * nr_checkouts , struct mem_pool * ce_mem_pool )
246246{
247- struct cache_entry * ce = active_cache [pos ];
247+ struct cache_entry * ce = the_index . cache [pos ];
248248 const char * path = ce -> name ;
249249 mmfile_t ancestor , ours , theirs ;
250250 enum ll_merge_result merge_status ;
@@ -257,7 +257,7 @@ static int checkout_merged(int pos, const struct checkout *state,
257257 int renormalize = 0 ;
258258
259259 memset (threeway , 0 , sizeof (threeway ));
260- while (pos < active_nr ) {
260+ while (pos < the_index . cache_nr ) {
261261 int stage ;
262262 stage = ce_stage (ce );
263263 if (!stage || strcmp (path , ce -> name ))
@@ -266,7 +266,7 @@ static int checkout_merged(int pos, const struct checkout *state,
266266 if (stage == 2 )
267267 mode = create_ce_mode (ce -> ce_mode );
268268 pos ++ ;
269- ce = active_cache [pos ];
269+ ce = the_index . cache [pos ];
270270 }
271271 if (is_null_oid (& threeway [1 ]) || is_null_oid (& threeway [2 ]))
272272 return error (_ ("path '%s' does not have necessary versions" ), path );
@@ -392,8 +392,8 @@ static int checkout_worktree(const struct checkout_opts *opts,
392392 if (pc_workers > 1 )
393393 init_parallel_checkout ();
394394
395- for (pos = 0 ; pos < active_nr ; pos ++ ) {
396- struct cache_entry * ce = active_cache [pos ];
395+ for (pos = 0 ; pos < the_index . cache_nr ; pos ++ ) {
396+ struct cache_entry * ce = the_index . cache [pos ];
397397 if (ce -> ce_flags & CE_MATCHED ) {
398398 if (!ce_stage (ce )) {
399399 errs |= checkout_entry (ce , & state ,
@@ -541,13 +541,13 @@ static int checkout_paths(const struct checkout_opts *opts,
541541 * Make sure all pathspecs participated in locating the paths
542542 * to be checked out.
543543 */
544- for (pos = 0 ; pos < active_nr ; pos ++ )
544+ for (pos = 0 ; pos < the_index . cache_nr ; pos ++ )
545545 if (opts -> overlay_mode )
546- mark_ce_for_checkout_overlay (active_cache [pos ],
546+ mark_ce_for_checkout_overlay (the_index . cache [pos ],
547547 ps_matched ,
548548 opts );
549549 else
550- mark_ce_for_checkout_no_overlay (active_cache [pos ],
550+ mark_ce_for_checkout_no_overlay (the_index . cache [pos ],
551551 ps_matched ,
552552 opts );
553553
@@ -562,8 +562,8 @@ static int checkout_paths(const struct checkout_opts *opts,
562562 unmerge_marked_index (& the_index );
563563
564564 /* Any unmerged paths? */
565- for (pos = 0 ; pos < active_nr ; pos ++ ) {
566- const struct cache_entry * ce = active_cache [pos ];
565+ for (pos = 0 ; pos < the_index . cache_nr ; pos ++ ) {
566+ const struct cache_entry * ce = the_index . cache [pos ];
567567 if (ce -> ce_flags & CE_MATCHED ) {
568568 if (!ce_stage (ce ))
569569 continue ;
@@ -868,7 +868,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
868868 }
869869 }
870870
871- if (!cache_tree_fully_valid (active_cache_tree ))
871+ if (!cache_tree_fully_valid (the_index . cache_tree ))
872872 cache_tree_update (& the_index , WRITE_TREE_SILENT | WRITE_TREE_REPAIR );
873873
874874 if (write_locked_index (& the_index , & lock_file , COMMIT_LOCK ))
0 commit comments