Skip to content

Commit 08e752e

Browse files
authored
Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache
add: use preload-index and fscache for performance
2 parents 6619f79 + 38df35b commit 08e752e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

builtin/add.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
376376
return 0;
377377
}
378378

379-
if (read_cache() < 0)
380-
die(_("index file corrupt"));
381-
382379
/*
383380
* Check the "pathspec '%s' did not match any files" block
384381
* below before enabling new magic.
@@ -389,6 +386,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
389386
PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE,
390387
prefix, argv);
391388

389+
enable_fscache(1);
390+
if (read_cache_preload(&pathspec) < 0)
391+
die(_("index file corrupt"));
392+
392393
if (add_new_files) {
393394
int baselen;
394395

0 commit comments

Comments
 (0)