Merge branch 'bp/add-diff-files-optim'

"git add" needs to internally run "diff-files" equivalent, and the
codepath learned the same optimization as "diff-files" has to run
lstat(2) in parallel to find which paths have been updated in the
working tree.

* bp/add-diff-files-optim:
  add: speed up cmd_add() by utilizing read_cache_preload()
This commit is contained in:
Junio C Hamano 2018-11-13 22:37:27 +09:00
commit 9235a6ce47

View File

@ -445,11 +445,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
return 0;
}
if (read_cache() < 0)
die(_("index file corrupt"));
die_in_unpopulated_submodule(&the_index, prefix);
/*
* Check the "pathspec '%s' did not match any files" block
* below before enabling new magic.
@ -459,6 +454,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
PATHSPEC_SYMLINK_LEADING_PATH,
prefix, argv);
if (read_cache_preload(&pathspec) < 0)
die(_("index file corrupt"));
die_in_unpopulated_submodule(&the_index, prefix);
die_path_inside_submodule(&the_index, &pathspec);
if (add_new_files) {