Skip to content

Commit

Permalink
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_…
Browse files Browse the repository at this point in the history
…fscache

add: use preload-index and fscache for performance
  • Loading branch information
dscho committed Oct 12, 2018
2 parents 877fd24 + c1fc6f8 commit 79f371f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)

die_path_inside_submodule(&the_index, &pathspec);

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;

Expand Down
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,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! */
Expand Down
6 changes: 2 additions & 4 deletions preload-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "fsmonitor.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 */
}
Expand Down Expand Up @@ -73,8 +72,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];
Expand Down

0 comments on commit 79f371f

Please sign in to comment.