Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:27 +0300
committerJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:27 +0300
commit9235a6ce47f012cd8fcfa80117fed29790bb929b (patch)
tree29613880808e72561e221db1dcb7b824a53bb9f3 /builtin
parent39d23dfa409e51844ddda99599927092c8300f12 (diff)
parentd1664e73ad96aa08735bf81d48ec0fb6d196cc3e (diff)
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()
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ad49806ebf..f65c172299 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -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) {