Merge branch 'ab/the-index-compatibility'

Remove more remaining uses of macros that relies on the_index
singleton instance without explicitly spelling it out.

* ab/the-index-compatibility:
  cocci & cache.h: remove "USE_THE_INDEX_COMPATIBILITY_MACROS"
  cache-tree API: remove redundant update_main_cache_tree()
  cocci & cache-tree.h: migrate "write_cache_as_tree" to "*_index_*"
  cocci & cache.h: apply pending "index_cache_pos" rule
  cocci & cache.h: fully apply "active_nr" part of index-compatibility
  builtin/rm.c: use narrower "USE_THE_INDEX_VARIABLE"
This commit is contained in:
Junio C Hamano
2023-02-22 14:55:44 -08:00
12 changed files with 62 additions and 87 deletions

12
cache.h
View File

@ -449,18 +449,8 @@ typedef int (*must_prefetch_predicate)(const struct cache_entry *);
void prefetch_cache_entries(const struct index_state *istate,
must_prefetch_predicate must_prefetch);
#if defined(USE_THE_INDEX_COMPATIBILITY_MACROS) || defined(USE_THE_INDEX_VARIABLE)
#ifdef USE_THE_INDEX_VARIABLE
extern struct index_state the_index;
#ifndef USE_THE_INDEX_VARIABLE
#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
#define active_nr (the_index.cache_nr)
#define read_cache() repo_read_index(the_repository)
#define discard_cache() discard_index(&the_index)
#define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen))
#endif
#endif
#endif
#define TYPE_BITS 3