git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] sparse-checkout: use default patterns for 'set' only !stdin

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 28, 2023, 00:18 UTC
Message-ID
<xmqq1qb7kwlq.fsf@gitster.g>
In-Reply-To
<CABPp-BF3Vqq8Y8+2pQyO7-StUVPR3as+Q_aL+o92ydoJY-8zEw@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 17 quoted lines
>> diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
>> index 8f55127202..04ae81fce8 100644
>> --- a/builtin/sparse-checkout.c
>> +++ b/builtin/sparse-checkout.c
>> @@ -837,7 +837,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
>>          * non-cone mode, if nothing is specified, manually select just the
>>          * top-level directory (much as 'init' would do).
>>          */
>> -       if (!core_sparse_checkout_cone && argc == 0) {
>> +       if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
>>                 argv = default_patterns;
>>                 argc = default_patterns_nr;
>>         } else {
>> --
>> 2.43.0-174-g055bb6e996
>
> Thanks for catching this; the fix looks good to me.
Actually I am not so sure.

An obvious alternative would be to collect the patterns, either from the command line or from the standard input, and then use the default when we collected nothing.

But I guess those who use the standard input should be able to specify everything fully, so it would probably be OK.

Previous: Elijah NewrenNext: Junio C Hamano
Message 4 of 7 in “sparse-checkout with --end-of-options”
  1. 0/3 sparse-checkout with --end-of-optionsJunio C Hamano, Dec 21, 2023
  2. 2/3 sparse-checkout: use default patterns for 'set' only !stdinJunio C Hamano, Dec 21, 2023
  3. Elijah NewrenDec 24, 2023
  4. Junio C HamanoDec 28, 2023
  5. 3/3 sparse-checkout: tighten add_patterns_from_input()Junio C Hamano, Dec 21, 2023
  6. 1/3 sparse-checkout: take care of "--end-of-options" in set/add/check-rulesJunio C Hamano, Dec 21, 2023
  7. Elijah NewrenDec 24, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.