Re: [PATCH] rm: honor sparse checkout patterns
- From
Elijah Newren <newren@gmail.com>
- Date
- Nov 17, 2020, 04:53 UTC
- Message-ID
- <CABPp-BFFcP5a26f3o1_gna=G-WcP1LD78aKztjbWOgjeD5F52A@mail.gmail.com>
- In-Reply-To
- <be43763e-6931-3e84-8e5a-0ac839cc0566@jeffhostetler.com>
On Mon, Nov 16, 2020 at 6:30 AM Jeff Hostetler <git@jeffhostetler.com> wrote:
Show 27 quoted lines
> > On 11/13/20 8:47 AM, Derrick Stolee wrote: > > On 11/12/2020 6:54 PM, Elijah Newren wrote: > >> Hi, > >> > >> On Thu, Nov 12, 2020 at 1:02 PM Matheus Tavares > >> <matheus.bernardino@usp.br> wrote: > >>> > >>> 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. > >> > >> (For Stolee:) Did this arise when a user specified a directory to > >> delete, and a (possibly small) part of that directory was in the > >> sparse checkout while other portions of it were outside? > > > > The user who suggested this used a command like 'git rm */*.csprojx' to > > remove all paths with that file extension, but then realized that they > > were deleting all of those files from the entire repo, not just the > > current sparse-checkout. > > Aren't the wildcards expanded by the shell before the command > line is given to Git? So the Git command should only receive > command line args that actually match existing files, right??
Good point. I suspect, though, that the issue may still be a problem if the user were to quote the wildcards; that may have been what happened and the reporting of the case just lost them somewhere along the way.