Skip to content

Commit 2f88c19

Browse files
committed
diff-index: pass pathspec down to unpack-trees machinery
And finally, pass the pathspec down through unpack_trees() to traverse_trees() callchain. Before and after applying this series, looking for changes in the kernel repository with a fairly narrow pathspec becomes somewhat faster. (without patch) $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null 0.48user 0.05system 0:00.53elapsed 100%CPU (0avgtext+0avgdata 163296maxresident)k 0inputs+952outputs (0major+11163minor)pagefaults 0swaps (with patch) $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null 0.01user 0.00system 0:00.02elapsed 104%CPU (0avgtext+0avgdata 43856maxresident)k 0inputs+24outputs (0major+3688minor)pagefaults 0swaps Signed-off-by: Junio C Hamano <[email protected]>
1 parent 40e3725 commit 2f88c19

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

diff-lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ int run_diff_index(struct rev_info *revs, int cached)
463463
opts.unpack_data = revs;
464464
opts.src_index = &the_index;
465465
opts.dst_index = NULL;
466+
opts.pathspec = &revs->diffopt.pathspec;
466467

467468
init_tree_desc(&t, tree->buffer, tree->size);
468469
if (unpack_trees(1, &t, &opts))

0 commit comments

Comments
 (0)