[PATCH 3/3] diff-index: pass pathspec down to unpack-trees machinery
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 29, 2011, 21:33 UTC
- Message-ID
- <1314653603-7533-4-git-send-email-gitster@pobox.com>
- In-Reply-To
- <1314653603-7533-1-git-send-email-gitster@pobox.com>
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 gets a moderate speeds up.
(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 <gitster@pobox.com> --- diff-lib.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c index f8454dd..ebe751e 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -468,6 +468,7 @@ static int diff_cache(struct rev_info *revs, opts.unpack_data = revs; opts.src_index = &the_index; opts.dst_index = NULL; + opts.pathspec = &revs->diffopt.pathspec; init_tree_desc(&t, tree->buffer, tree->size); return unpack_trees(1, &t, &opts);
-- 1.7.7.rc0.70.g82660