Skip to content

Commit 41c404c

Browse files
committed
Merge pull request git-for-windows#971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents 011024d + dc21f40 commit 41c404c

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
@@ -577,6 +577,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
577577
die_in_unpopulated_submodule(&the_index, prefix);
578578
die_path_inside_submodule(&the_index, &pathspec);
579579

580+
enable_fscache(1);
581+
/* We do not really re-read the index but update the up-to-date flags */
582+
preload_index(&the_index, &pathspec, 0);
583+
580584
if (add_new_files) {
581585
int baselen;
582586

@@ -678,6 +682,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
678682
die(_("Unable to write new index file"));
679683

680684
dir_clear(&dir);
685+
enable_fscache(0);
681686
UNLEAK(pathspec);
682687
return exit_status;
683688
}

0 commit comments

Comments
 (0)