Skip to content

Commit 79f371f

Browse files
committed
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents 877fd24 + c1fc6f8 commit 79f371f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

‎builtin/add.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
461461

462462
die_path_inside_submodule(&the_index, &pathspec);
463463

464+
enable_fscache(1);
465+
/* We do not really re-read the index but update the up-to-date flags */
466+
preload_index(&the_index, &pathspec);
467+
464468
if (add_new_files){
465469
intbaselen;
466470

‎cache.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ extern int daemonize(void);
659659
/* Initialize and use the cache information */
660660
structlock_file;
661661
externintread_index(structindex_state*);
662+
externvoidpreload_index(structindex_state*, conststructpathspec*pathspec);
662663
externintread_index_preload(structindex_state*, conststructpathspec*pathspec);
663664
externintdo_read_index(structindex_state*istate, constchar*path,
664665
intmust_exist); /* for testting only! */

‎preload-index.c‎

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

99
#ifdefNO_PTHREADS
10-
staticvoidpreload_index(structindex_state*index,
11-
conststructpathspec*pathspec)
10+
voidpreload_index(structindex_state*index, conststructpathspec*pathspec)
1211
{
1312
; /* nothing */
1413
}
@@ -73,8 +72,7 @@ static void *preload_thread(void *_data)
7372
returnNULL;
7473
}
7574

76-
staticvoidpreload_index(structindex_state*index,
77-
conststructpathspec*pathspec)
75+
voidpreload_index(structindex_state*index, conststructpathspec*pathspec)
7876
{
7977
intthreads, i, work, offset;
8078
structthread_datadata[MAX_PARALLEL];

0 commit comments

Comments
(0)