Subject: Re: [PATCH v3 2/7] sparse-checkout: add basics of 'clean' command

From: Derrick Stolee <[email-masked]>
Date: Mon, 20 Oct 2025 10:16:42 -0400

On 10/7/25 6:49 PM, Elijah Newren wrote:
> On Fri, Sep 12, 2025 at 3:30 AM Derrick Stolee via GitGitGadget

>> +Some special cases, such as merge conflicts or modified files outside of
>> +the sparse-checkout definition could lead to keeping files that would
>> +otherwise be removed. Resolve conflicts, stage modifications, and use
>> +`git sparse-checkout reapply` in conjunction with `git sparse-checkout
>> +clean` to resolve these cases.
>> ++
>> +This command can be used to be sure the sparse index works efficiently,
>> +though it does not require enabling the sparse index feature via the
>> +`index.sparse=true` configuration.
> 
> This expanded explanation for users is nice too.  I particularly like
> that you called out three things users need to use in conjunction with
> this command -- resolving conflicts, staging modifications, and using
> `git sparse-checkout reapply`...

These cases are about 'git sparse-checkout clean' itself...
> [...]
>> +       if (convert_to_sparse(repo->index, SPARSE_INDEX_MEMORY_ONLY) ||
>> +           repo->index->sparse_index == INDEX_EXPANDED)
>> +               die(_("failed to convert index to a sparse index; resolve merge conflicts and try again"));
> 
> ...yet the error message you give to users only lists one of those
> three things even though the other two may be the problem.  Could we
> fix up the error message?

But this is specifically about the convert_to_sparse() action, which
is very limited in what could cause it to fail.

I _will_ update the advice later (added in Patch 6) to include the
more detailed set of actions.

Thanks,
-Stolee