summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-13 16:36:30 -0800
committerJunio C Hamano <gitster@pobox.com>2008-11-14 19:11:49 -0800
commit671c9b7e315db89081cc69f83a8f405e4aca37bc (patch)
tree0410fb1af855fc65a7d96dd15410db16e41cbc9f /builtin-commit.c
parenta0d3ab9c277f1a198ec8e29432c0127d4cf719d2 (diff)
downloadgit-671c9b7e315db89081cc69f83a8f405e4aca37bc.tar.gz
Add cache preload facility
This can do the lstat() storm in parallel, giving potentially much improved performance for cold-cache cases or things like NFS that have weak metadata caching. Just use "read_cache_preload()" instead of "read_cache()" to force an optimistic preload of the index stat data. The function takes a pathspec as its argument, allowing us to preload only the relevant portion of the index. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index 591d16b91e..1677e6b45f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -225,18 +225,18 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
if (interactive) {
interactive_add(argc, argv, prefix);
- if (read_cache() < 0)
+ if (read_cache_preload(NULL) < 0)
die("index file corrupt");
commit_style = COMMIT_AS_IS;
return get_index_file();
}
- if (read_cache() < 0)
- die("index file corrupt");
-
if (*argv)
pathspec = get_pathspec(prefix, argv);
+ if (read_cache_preload(pathspec) < 0)
+ die("index file corrupt");
+
/*
* Non partial, non as-is commit.
*