Subject: [PATCH v3 20/20] cache.h: make the_index part of "compatibility macros"

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Wed, 6 Jun 2018 09:39:33 +0200

While the_index is not actually a macro, its use throughout the code
base is dangerous because developers sometimes may not see that some
function is using the_index (instead of some other index that the devs
are interested in).

By keeping the_index part of this NO_ macro, we try to reduce its use
more and more until it's completely gone.

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 cache.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cache.h b/cache.h
index 5939233eb7..242aaa5498 100644
--- a/cache.h
+++ b/cache.h
@@ -330,8 +330,6 @@ struct index_state {
 	struct ewah_bitmap *fsmonitor_dirty;
 };
 
-extern struct index_state the_index;
-
 /* Name hashing */
 extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
 extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
@@ -340,6 +338,8 @@ extern void free_name_hash(struct index_state *istate);

 #ifndef NO_THE_INDEX_COMPATIBILITY_MACROS
+extern struct index_state the_index;
+
 #define active_cache (the_index.cache)
 #define active_nr (the_index.cache_nr)
 #define active_alloc (the_index.cache_alloc)
-- 
2.18.0.rc0.333.g22e6ee6cdf