Re: [PATCH 5/7] sparse-checkout: reject non-cone-mode patterns starting with a '#'
From: Junio C Hamano <hidden>
Date: 2022-02-16 03:05:42
Elijah Newren [off-list ref] writes:
quoted
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.