diff --git a/builtin/add.c b/builtin/add.c index e8fb80b36e7386..c3736aadcd6660 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -389,6 +389,10 @@ int cmd_add(int argc, const char **argv, const char *prefix) PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE, prefix, argv); + enable_fscache(1); + /* We do not really re-read the index, but update the up-to-date flags */ + preload_index(&the_index, &pathspec); + if (add_new_files) { int baselen; diff --git a/cache.h b/cache.h index a55564cae0478a..06d31b07a0d058 100644 --- a/cache.h +++ b/cache.h @@ -576,6 +576,7 @@ extern int daemonize(void); /* Initialize and use the cache information */ struct lock_file; extern int read_index(struct index_state *); +extern void preload_index(struct index_state *, const struct pathspec *pathspec); extern int read_index_preload(struct index_state *, const struct pathspec *pathspec); extern int do_read_index(struct index_state *istate, const char *path, int must_exist); /* for testting only! */ diff --git a/preload-index.c b/preload-index.c index bd02ba03207f25..f649d0c828cb4b 100644 --- a/preload-index.c +++ b/preload-index.c @@ -6,8 +6,7 @@ #include "dir.h" #ifdef NO_PTHREADS -static void preload_index(struct index_state *index, - const struct pathspec *pathspec) +void preload_index(struct index_state *index, const struct pathspec *pathspec) { ; /* nothing */ } @@ -71,8 +70,7 @@ static void *preload_thread(void *_data) return NULL; } -static void preload_index(struct index_state *index, - const struct pathspec *pathspec) +void preload_index(struct index_state *index, const struct pathspec *pathspec) { int threads, i, work, offset; struct thread_data data[MAX_PARALLEL];