diff mbox series

[5/5] repository: drop global `the_index` variable

Message ID 80c36225bc9ae9a79710213e1fb30cdb2a924e8d.1713180749.git.ps@pks.im (mailing list archive)
State New
Headers show
Series global: drop external `the_index` variable | expand

Commit Message

Patrick Steinhardt April 15, 2024, 11:43 a.m. UTC
All users of `the_index` have been converted to use either a custom
`struct index_state *` or the index provided by `the_repository`. We can
thus drop the globally-accessible declaration of this variable.

This concludes the quest to make Git `the_index` free, which has started
with 4aab5b46f4 (Make read-cache.c "the_index" free., 2007-04-01).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 repository.c | 4 ++--
 repository.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/repository.c b/repository.c
index d64d15d952..cbaa6ef7ee 100644
--- a/repository.c
+++ b/repository.c
@@ -2,7 +2,7 @@ 
  * not really _using_ the compat macros, just make sure the_index
  * declaration matches the definition in this file.
  */
-#define USE_THE_INDEX_VARIABLE
+
 #include "git-compat-util.h"
 #include "abspath.h"
 #include "repository.h"
@@ -23,7 +23,7 @@ 
 /* The main repository */
 static struct repository the_repo;
 struct repository *the_repository;
-struct index_state the_index;
+static struct index_state the_index;
 
 static void initialize_repository(struct repository *repo,
 				  struct index_state *index)
diff --git a/repository.h b/repository.h
index 268436779c..6f4af15417 100644
--- a/repository.h
+++ b/repository.h
@@ -187,9 +187,6 @@  struct repository {
 };
 
 extern struct repository *the_repository;
-#ifdef USE_THE_INDEX_VARIABLE
-extern struct index_state the_index;
-#endif
 
 /*
  * Define a custom repository layout. Any field can be NULL, which