summaryrefslogtreecommitdiff
path: root/builtin-diff.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-14 00:36:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-11-15 03:11:49 (GMT)
commit671c9b7e315db89081cc69f83a8f405e4aca37bc (patch)
tree0410fb1af855fc65a7d96dd15410db16e41cbc9f /builtin-diff.c
parenta0d3ab9c277f1a198ec8e29432c0127d4cf719d2 (diff)
downloadgit-671c9b7e315db89081cc69f83a8f405e4aca37bc.zip
git-671c9b7e315db89081cc69f83a8f405e4aca37bc.tar.gz
git-671c9b7e315db89081cc69f83a8f405e4aca37bc.tar.bz2
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-diff.c')
-rw-r--r--builtin-diff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index 7ceceeb..1447c1d 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -134,8 +134,8 @@ static int builtin_diff_index(struct rev_info *revs,
revs->max_count != -1 || revs->min_age != -1 ||
revs->max_age != -1)
usage(builtin_diff_usage);
- if (read_cache() < 0) {
- perror("read_cache");
+ if (read_cache_preload(revs->diffopt.paths) < 0) {
+ perror("read_cache_preload");
return -1;
}
return run_diff_index(revs, cached);
@@ -234,8 +234,8 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
revs->combine_merges = revs->dense_combined_merges = 1;
setup_work_tree();
- if (read_cache() < 0) {
- perror("read_cache");
+ if (read_cache_preload(revs->diffopt.paths) < 0) {
+ perror("read_cache_preload");
return -1;
}
result = run_diff_files(revs, options);