Skip to content

Commit 91f36e1

Browse files
committed
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents a829866 + f9b88bf commit 91f36e1

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
@@ -540,6 +540,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
540540
die_in_unpopulated_submodule(&the_index, prefix);
541541
die_path_inside_submodule(&the_index, &pathspec);
542542

543+
enable_fscache(1);
544+
/* We do not really re-read the index but update the up-to-date flags */
545+
preload_index(&the_index, &pathspec, 0);
546+
543547
dir_init(&dir);
544548
if (add_new_files) {
545549
int baselen;
@@ -618,6 +622,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
618622
die(_("Unable to write new index file"));
619623

620624
dir_clear(&dir);
625+
enable_fscache(0);
621626
UNLEAK(pathspec);
622627
return exit_status;
623628
}

0 commit comments

Comments
 (0)