aboutsummaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-20 21:47:30 -0700
committerJunio C Hamano <gitster@pobox.com>2009-06-20 21:47:30 -0700
commitc28a17f270a51a4ed5e432e83c0ed962361a37c9 (patch)
tree6b7c829a56d0e09d8f0b80adb1d035889ce14d77 /unpack-trees.c
parentdeded16d151ff0f7b80ed21a518928daff09c14c (diff)
parenta0919ced8a5efe938cf97c74a0f851cbbe00aaf6 (diff)
downloadgit-c28a17f270a51a4ed5e432e83c0ed962361a37c9.tar.gz
git-c28a17f270a51a4ed5e432e83c0ed962361a37c9.tar.xz
Merge branch 'jc/cache-tree'
* jc/cache-tree: Avoid "diff-index --cached" optimization under --find-copies-harder Optimize "diff-index --cached" using cache-tree t4007: modernize the style cache-tree.c::cache_tree_find(): simplify internal API write-tree --ignore-cache-tree
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index aaacaf101..8eb3ddb39 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -326,6 +326,23 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
if (src[0])
conflicts |= 1;
}
+
+ /* special case: "diff-index --cached" looking at a tree */
+ if (o->diff_index_cached &&
+ n == 1 && dirmask == 1 && S_ISDIR(names->mode)) {
+ int matches;
+ matches = cache_tree_matches_traversal(o->src_index->cache_tree,
+ names, info);
+ /*
+ * Everything under the name matches. Adjust o->pos to
+ * skip the entire hierarchy.
+ */
+ if (matches) {
+ o->pos += matches;
+ return mask;
+ }
+ }
+
if (traverse_trees_recursive(n, dirmask, conflicts,
names, info) < 0)
return -1;