Re: [PATCH 5/7] sparse-checkout: reject non-cone-mode patterns starting with a '#'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 16, 2022, 03:05 UTC
- Message-ID
- <xmqqzgmrv7d1.fsf@gitster.g>
- In-Reply-To
- <CABPp-BFymV-bQVfT7u1phO1N8MHu03SfbVa6Q+CDKeJL21Fbwg@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 8 quoted lines
>> I do not quite get where you are seeing an inconsistency. Do you
>> mean that it is inconsistent that "# comment" is only allowed in
>> files but not on the command line?
>
> I don't understand what distinction you are trying to make between the
> file or the command line; for non-cone mode, all positional arguments
> to sparse-checkout {add,set} are taken as-is and inserted into the
> $GIT_DIR/info/sparse-checkout file directly.If so, then '# comment" from the command line would be a valid way to spell a comment, no? It sounds like the right thing to do here is just passing it through to $GIT_DIR/info/sparse-checkout and let it become comment, instead of warning, \-quoting, or rejecting.
> I don't like just assuming that users are specifying paths rather than > patterns, when non-cone mode is all about specifying patterns rather > than paths; it just feels broken to me.
Oh, I don't like such an assumption, either. If the user gives a pathspec, we do assume that is a collection of patterns. If we are taking patterns from the command line, treating them as patterns is the right thing to do. I do not see how that interacts with what a path or pattern that begins with a pound should be handled, though.