Skip to content

Un-pessimize "diff-index $commit -- $pathspec"

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3traverse_trees(): allow pruning with pathspectree-walk.c tree-walk.h+34 -66 replies
2/3unpack-trees: allow pruning with pathspecunpack-trees.c unpack-trees.h+3 -03 replies
3/3diff-index: pass pathspec down to unpack-trees machinerydiff-lib.c+1 -016 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Un-pessimize "diff-index $commit -- $pathspec"

"git diff A B -- $pathspec" to compare two tree-ishes knew how to apply pathspec to avoid opening trees that fall outside the area of interest, but "git diff A -- $pathspec" used unpack_trees() machinery that was meant for full-tree merges, and ended up reading the whole tree only to discard potentially major part of the work it does.

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

Junio C Hamano (3):
tree-walk: allow pruning with pathspec
unpack-trees: allow pruning with pathspec
diff-index: pass pathspec down to unpack-trees machinery

 diff-lib.c     |    1 +
 tree-walk.c    |   39 +++++++++++++++++++++++++++++++++------
 tree-walk.h    |    1 +
 unpack-trees.c |    2 ++
 unpack-trees.h |    1 +
 5 files changed, 38 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.7.rc0.70.g82660