Skip to content

Commit ca35d70

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Export the preload_index() function
The purpose of this function is to stat() the files listed in the index in a multi-threaded fashion. It is called directly after reading the index in the read_index_preloaded() function. However, in some cases we may want to separate the index reading from the preloading step, e.g. in builtin/add.c, where we need to load the index before we parse the pathspecs (which needs to error out if one of the pathspecs refers to a path within a submodule, for which the index must have been read already), and only then will we want to preload, possibly limited by the just-parsed pathspecs. So let's just export that function to allow calling it separately. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 99cb738 commit ca35d70

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ extern int daemonize(void);
560560
/* Initialize and use the cache information */
561561
struct lock_file;
562562
extern int read_index(struct index_state *);
563+
extern void preload_index(struct index_state *, const struct pathspec *pathspec);
563564
extern int read_index_preload(struct index_state *, const struct pathspec *pathspec);
564565
extern int do_read_index(struct index_state *istate, const char *path,
565566
int must_exist); /* for testting only! */

preload-index.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include "dir.h"
77

88
#ifdef NO_PTHREADS
9-
static void preload_index(struct index_state *index,
10-
const struct pathspec *pathspec)
9+
void preload_index(struct index_state *index, const struct pathspec *pathspec)
1110
{
1211
; /* nothing */
1312
}
@@ -67,8 +66,7 @@ static void *preload_thread(void *_data)
6766
return NULL;
6867
}
6968

70-
static void preload_index(struct index_state *index,
71-
const struct pathspec *pathspec)
69+
void preload_index(struct index_state *index, const struct pathspec *pathspec)
7270
{
7371
int threads, i, work, offset;
7472
struct thread_data data[MAX_PARALLEL];

0 commit comments

Comments
 (0)