preload-index.h: move declarations for preload-index.c from elsewhere

We already have a preload-index.c file; move the declarations for the functions in that file into a new preload-index.h. These were previously split between cache.h and repository.h. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed May 16, 2023 at 06:33 UTC fbffdfb11cba61dbce46442d0b136dcf2ddaeadc
15 files changed +27 -6
add-interactive.c
+1
@@ -5,6 +5,7 @@
5 #include "diffcore.h"
6 #include "gettext.h"
7 #include "hex.h"
8 +#include "preload-index.h"
9 #include "revision.h"
10 #include "refs.h"
11 #include "string-list.h"
builtin/add.c
+1
@@ -17,6 +17,7 @@
17 #include "cache-tree.h"
18 #include "run-command.h"
19 #include "parse-options.h"
20 +#include "preload-index.h"
21 #include "diff.h"
22 #include "diffcore.h"
23 #include "revision.h"
builtin/am.c
+1
@@ -29,6 +29,7 @@
29 #include "unpack-trees.h"
30 #include "branch.h"
31 #include "object-name.h"
32 +#include "preload-index.h"
33 #include "sequencer.h"
34 #include "revision.h"
35 #include "merge-recursive.h"
builtin/checkout.c
+1
@@ -20,6 +20,7 @@
20 #include "object-name.h"
21 #include "object-store.h"
22 #include "parse-options.h"
23 +#include "preload-index.h"
24 #include "refs.h"
25 #include "remote.h"
26 #include "resolve-undo.h"
builtin/commit.c
+1
@@ -30,6 +30,7 @@
30 #include "utf8.h"
31 #include "object-name.h"
32 #include "parse-options.h"
33 +#include "preload-index.h"
34 #include "string-list.h"
35 #include "rerere.h"
36 #include "unpack-trees.h"
builtin/diff-files.c
+1
@@ -8,6 +8,7 @@
8 #include "diff.h"
9 #include "diff-merges.h"
10 #include "commit.h"
11 +#include "preload-index.h"
12 #include "revision.h"
13 #include "builtin.h"
14 #include "submodule.h"
builtin/diff-index.c
+1
@@ -3,6 +3,7 @@
3 #include "diff.h"
4 #include "diff-merges.h"
5 #include "commit.h"
6 +#include "preload-index.h"
7 #include "revision.h"
8 #include "builtin.h"
9 #include "setup.h"
builtin/diff.c
+1
@@ -16,6 +16,7 @@
16 #include "diff.h"
17 #include "diff-merges.h"
18 #include "diffcore.h"
19 +#include "preload-index.h"
20 #include "revision.h"
21 #include "log-tree.h"
22 #include "builtin.h"
builtin/stash.c
+1
@@ -17,6 +17,7 @@
17 #include "run-command.h"
18 #include "dir.h"
19 #include "entry.h"
20 +#include "preload-index.h"
21 #include "rerere.h"
22 #include "revision.h"
23 #include "setup.h"
builtin/submodule--helper.c
+1
@@ -11,6 +11,7 @@
11 #include "parse-options.h"
12 #include "quote.h"
13 #include "pathspec.h"
14 +#include "preload-index.h"
15 #include "dir.h"
16 #include "setup.h"
17 #include "sparse-index.h"
cache.h
-3
@@ -318,9 +318,6 @@ extern struct index_state the_index;
318
319 /* Initialize and use the cache information */
320 struct lock_file;
321 -void preload_index(struct index_state *index,
322 - const struct pathspec *pathspec,
323 - unsigned int refresh_flags);
321 int do_read_index(struct index_state *istate, const char *path,
322 int must_exist); /* for testting only! */
323 int read_index_from(struct index_state *, const char *path,
preload-index.c
+1
@@ -8,6 +8,7 @@
8 #include "fsmonitor.h"
9 #include "gettext.h"
10 #include "config.h"
11 +#include "preload-index.h"
12 #include "progress.h"
13 #include "thread-utils.h"
14 #include "repository.h"
preload-index.h new
+15
@@ -0,0 +1,15 @@
1 +#ifndef PRELOAD_INDEX_H
2 +#define PRELOAD_INDEX_H
3 +
4 +struct index_state;
5 +struct pathspec;
6 +struct repository;
7 +
8 +void preload_index(struct index_state *index,
9 + const struct pathspec *pathspec,
10 + unsigned int refresh_flags);
11 +int repo_read_index_preload(struct repository *,
12 + const struct pathspec *pathspec,
13 + unsigned refresh_flags);
14 +
15 +#endif /* PRELOAD_INDEX_H */
read-cache.c
+1
@@ -27,6 +27,7 @@
27 #include "mem-pool.h"
28 #include "name-hash.h"
29 #include "object-name.h"
30 +#include "preload-index.h"
31 #include "resolve-undo.h"
32 #include "revision.h"
33 #include "run-command.h"
repository.h
-3
@@ -221,9 +221,6 @@ int repo_hold_locked_index(struct repository *repo,
221 struct lock_file *lf,
222 int flags);
223
224 -int repo_read_index_preload(struct repository *,
225 - const struct pathspec *pathspec,
226 - unsigned refresh_flags);
224 int repo_read_index_unmerged(struct repository *);
225 /*
226 * Opportunistically update the index but do not complain if we can't.