Skip to content

Commit 5f54ac3

Browse files
committed
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents 0f6f277 + 6433c52 commit 5f54ac3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

builtin/add.c

Lines changed: 5 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
die_in_unpopulated_submodule(&the_index, prefix);
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, 0);
467+
464468
if (add_new_files) {
465469
int baselen;
466470

@@ -573,5 +577,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
573577
free(ps_matched);
574578
dir_clear(&dir);
575579
clear_pathspec(&pathspec);
580+
enable_fscache(0);
576581
return exit_status;
577582
}

0 commit comments

Comments
 (0)