Skip to content

Commit 8eb65c5

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 b2589ba + 35a052a commit 8eb65c5

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

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

@@ -676,6 +680,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
676680
die(_("Unable to write new index file"));
677681

678682
dir_clear(&dir);
683+
enable_fscache(0);
679684
UNLEAK(pathspec);
680685
return exit_status;
681686
}

0 commit comments

Comments
 (0)