"Kevin Willford via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > @@ -141,6 +143,18 @@ static void update_index_from_diff(struct diff_queue_struct *q, > > ce = make_cache_entry(&the_index, one->mode, &one->oid, one->path, > 0, 0); > + > + /* > + * If the file 1) corresponds to an existing index entry with > + * skip-worktree set, or 2) does not exist in the index but is > + * outside the sparse checkout definition, add a skip-worktree bit > + * to the new index entry. > + */ > + pos = cache_name_pos(one->path, strlen(one->path)); > + if ((pos >= 0 && ce_skip_worktree(active_cache[pos])) || > + (pos < 0 && !path_in_sparse_checkout(one->path, &the_index))) > + ce->ce_flags |= CE_SKIP_WORKTREE; OK. Nicely explained.