Subject: [PATCH 20/25] list-files: preload index

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Mon, 6 Apr 2015 20:52:29 +0700

Try to reduce refresh time. Note that we still need another
read_cache() at top top, before parse_pathspec() because this
*_SLASH_CHEAP needs the index loaded.

One day read_index() should be improved to notice that the on-disk
version is the same as the one in memory and skip I/O entirely..

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 builtin/list-files.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/list-files.c b/builtin/list-files.c
index 31c2336..948b8e6 100644
--- a/builtin/list-files.c
+++ b/builtin/list-files.c
@@ -529,6 +529,7 @@ int cmd_list_files(int argc, const char **argv, const char *cmd_prefix)
 	recursive_pathspec.max_depth = -1;
 	finalize_colopts(&colopts, -1);
 
+	read_cache_preload(&recursive_pathspec);
 	refresh_index(&the_index, REFRESH_QUIET | REFRESH_UNMERGED,
 		      &recursive_pathspec, NULL, NULL);
 
-- 
2.3.0.rc1.137.g477eb31