On Tue, Mar 24, 2020 at 3:30 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Elijah Newren <newren@xxxxxxxxx> writes: > > > On Mon, Mar 23, 2020 at 11:13 PM Matheus Tavares > > <matheus.bernardino@xxxxxx> wrote: > >> > >> In the last commit, git-grep learned to honor sparsity patterns. For > >> some use cases, however, it may be desirable to search outside the > >> sparse checkout. So add the '--ignore-sparsity' option, which restores > >> the old behavior. Also add the grep.ignoreSparsity configuration, to > >> allow setting this behavior by default. > > > > Should `--ignore-sparsity` be a global git option rather than a > > grep-specific one? Also, should grep.ignoreSparsity rather be > > core.ignoreSparsity or core.searchOutsideSparsePaths or something? > > Great question. I think "git diff" with various options would also > want to optionally be able to be confined within the sparse cone, or > checking the entire world by lazily fetching outside the sparsity. [...] > Regardless of the choice of the default, it would be a good > idea to make the subcommands consistently offer the same default and > allow the non-default views with the same UI. Yeah, it seems like a sensible path. Regarding implementation, there is the question that Elijah raised, of whether to use a global git option or separate but consistent options for each subcommand. I don't have much experience with sparse checkout to argument for one or another, so I would like to hear what others have to say about it. A question that comes to my mind regarding the global git option is: will --ignore-sparsity (or whichever name we choose for it [1]) be sufficient for all subcommands? Or may some of them require additional options for command-specific behaviors concerning sparsity patterns? Also, would it be OK if we just ignored the option in commands that do not operate differently in sparse checkouts (maybe, fetch, branch and send-email, for example)? And would it make sense to allow constructions such as `git --ignore-sparsity checkout` or even `git --ignore-sparsity sparse-checkout ...`? [1]: Does anyone have suggestions for the option/config name? The best I could come up with so far (without being too verbose) is --no-sparsity-constraints. But I fear this might sound generic. As Elijah already mentioned, --ignore-sparsity is not good either, as it introduces double negatives in code...