diff mbox series

[v2,15/27] repository.h: move declaration of the_index from cache.h

Message ID abfb127b812c3c7501e54bbb9213c8598056ad50.1683875070.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Header cleanups (final splitting of cache.h, and some splitting of other headers) | expand

Commit Message

Elijah Newren May 12, 2023, 7:04 a.m. UTC
From: Elijah Newren <newren@gmail.com>

the_index is a global variable defined in repository.c; as such, its
declaration feels better suited living in repository.h rather than
cache.h.  Move it.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 cache.h                          | 4 ----
 repository.h                     | 3 +++
 t/helper/test-dump-split-index.c | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Jonathan Tan May 15, 2023, 9:50 p.m. UTC | #1
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Elijah Newren <newren@gmail.com>
> 
> the_index is a global variable defined in repository.c; as such, its
> declaration feels better suited living in repository.h rather than
> cache.h.  Move it.
> 
> Signed-off-by: Elijah Newren <newren@gmail.com>

Up to here looks good. Now to look at the read-cache-ll/read-cache split
in patch 16...
diff mbox series

Patch

diff --git a/cache.h b/cache.h
index 5b690b80a16..11882897741 100644
--- a/cache.h
+++ b/cache.h
@@ -312,10 +312,6 @@  typedef int (*must_prefetch_predicate)(const struct cache_entry *);
 void prefetch_cache_entries(const struct index_state *istate,
 			    must_prefetch_predicate must_prefetch);
 
-#ifdef USE_THE_INDEX_VARIABLE
-extern struct index_state the_index;
-#endif
-
 /* Initialize and use the cache information */
 struct lock_file;
 int do_read_index(struct index_state *istate, const char *path,
diff --git a/repository.h b/repository.h
index f81228bcfb5..763794880ed 100644
--- a/repository.h
+++ b/repository.h
@@ -169,6 +169,9 @@  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
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index d1badd71126..63fde9157c4 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -2,6 +2,7 @@ 
 #include "test-tool.h"
 #include "cache.h"
 #include "hex.h"
+#include "repository.h"
 #include "setup.h"
 #include "split-index.h"
 #include "ewah/ewok.h"