Skip to content

Commit 805181e

Browse files
committed
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents 0d6d1ac + fba7669 commit 805181e

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
@@ -550,6 +550,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
550550
die_in_unpopulated_submodule(&the_index, prefix);
551551
die_path_inside_submodule(&the_index, &pathspec);
552552

553+
enable_fscache(1);
554+
/* We do not really re-read the index but update the up-to-date flags */
555+
preload_index(&the_index, &pathspec, 0);
556+
553557
if (add_new_files) {
554558
int baselen;
555559

@@ -653,5 +657,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
653657

654658
dir_clear(&dir);
655659
clear_pathspec(&pathspec);
660+
enable_fscache(0);
656661
return exit_status;
657662
}

0 commit comments

Comments
 (0)