Subject: Re: [PATCH] rm: honor sparse checkout patterns

From: Junio C Hamano <[email-masked]>
Date: Mon, 16 Nov 2020 12:14:22 -0800

Matheus Tavares <[email-masked]> writes:

> Make git-rm honor the 'sparse.restrictCmds' setting, by restricting its
> operation to the paths that match both the command line pathspecs and
> the repository's sparsity patterns.

> This better matches the expectations
> of users with sparse-checkout definitions, while still allowing them
> to optionally enable the old behavior with 'sparse.restrictCmds=false'
> or the global '--no-restrict-to-sparse-paths' option.

Hmph.  Is "rm" the only oddball that ignores the sparse setting?

>  to the paths specified by the sparsity patterns, or to the intersection of
>  those paths and any (like `*.c`) that the user might also specify on the
>  command line. When false, the affected commands will work on full trees,
> -ignoring the sparsity patterns. For now, only git-grep honors this setting.
> +ignoring the sparsity patterns. For now, only git-grep and git-rm honor this
> +setting.

I am not sure if this is a good direction to go---can we make an
inventory of all commands that affect working tree files and see
which ones need the same treatment before going forward with just
"grep" and "rm"?  Documenting the decision on the ones that will not
get the same treatment may also be a good idea.  What I am aiming
for is to prevent users from having to know in which versions of Git
they can rely on the sparsity patterns with what commands, and doing
things piecemeal like these two topics would be a road to confusion.

Thanks.