Skip to content

Commit

Permalink
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_…
Browse files Browse the repository at this point in the history
…fscache

add: use preload-index and fscache for performance
  • Loading branch information
dscho committed Oct 8, 2024
2 parents bc9e0c2 + 1f7092a commit 773d2d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
die_in_unpopulated_submodule(the_repository->index, prefix);
die_path_inside_submodule(the_repository->index, &pathspec);

enable_fscache(1);
/* We do not really re-read the index but update the up-to-date flags */
preload_index(the_repository->index, &pathspec, 0);

if (add_new_files) {
int baselen;

Expand Down Expand Up @@ -572,5 +576,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
free(ps_matched);
dir_clear(&dir);
clear_pathspec(&pathspec);
enable_fscache(0);
return exit_status;
}

0 comments on commit 773d2d7

Please sign in to comment.