Subject: Re: [PATCH 5/7] sparse-checkout: reject non-cone-mode patterns starting with a '#'

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Feb 2022 17:07:34 -0800

Elijah Newren <[email-masked]> writes:

> If this were the only special character case, I'd totally agree, but I
> do worry a bit that escaping this particular case might lead users to
> expect us to escape and fix other special characters from '*?[]!\'.

Sorry, but I do not quite get why it is a problem.  I understand
that the idea behind this "rejection" is that "#" is special only
when it appears in files (as comment introducer) and must be
prefixed with "\", right?

Do any of the wildcard characters mean different things depending on
where they appear?  Isn't '*' a wildcard to match 0-or-more-bytes
whether it appears in files or on the command line, and need to
prefixed with "\" to make it non-special regardless of where it is
found?

> If users have files with those characters and specify an argument with
> one of those, are we to automatically escape them as well?  If we
> don't escape the other characters but do escape '#', aren't we being
> inconsistent?

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?  If so, a way to make it
consistent may be to allow "# comment" even from the command line
;-)