[PATCH 05/10] unpack-trees: optimize full checkout case
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
unpack-trees.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index f005454..eb5d357 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -996,6 +996,16 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->el = ⪙
}
+ if (!o->skip_sparse_checkout &&
+ o->el->nr == 1 &&
+ !strcmp(o->el->excludes[0]->pattern, "*")) {
+ for (i = 0; i < o->src_index->cache_nr; i++)
+ if (ce_skip_worktree(o->src_index->cache[i]))
+ break;
+ if (i == o->src_index->cache_nr)
+ o->skip_sparse_checkout = 1;
+ }
+
if (!o->skip_sparse_checkout)
set_new_skip_worktree_1(o);
--
1.7.3.2.210.g045198