unpack-trees: be specific what part of the index has changed

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jun 13, 2014 at 19:19 UTC a5c446f11693b94194f32bad85df050fa1cde9af
1 file changed +6 -2
unpack-trees.c
+6 -2
@@ -246,7 +246,9 @@ static int verify_absent_sparse(const struct cache_entry *ce,
246 enum unpack_trees_error_types,
247 struct unpack_trees_options *o);
248
249 -static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_options *o)
249 +static int apply_sparse_checkout(struct index_state *istate,
250 + struct cache_entry *ce,
251 + struct unpack_trees_options *o)
252 {
253 int was_skip_worktree = ce_skip_worktree(ce);
254
@@ -254,6 +256,8 @@ static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_opt
256 ce->ce_flags |= CE_SKIP_WORKTREE;
257 else
258 ce->ce_flags &= ~CE_SKIP_WORKTREE;
259 + if (was_skip_worktree != ce_skip_worktree(ce))
260 + istate->cache_changed |= CE_ENTRY_CHANGED;
261
262 /*
263 * if (!was_skip_worktree && !ce_skip_worktree()) {
@@ -1131,7 +1135,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1135 ret = -1;
1136 }
1137
1134 - if (apply_sparse_checkout(ce, o)) {
1138 + if (apply_sparse_checkout(&o->result, ce, o)) {
1139 if (!o->show_all_errors)
1140 goto return_failed;
1141 ret = -1;