Re: [PATCH v3 09/12] sparse-checkout: properly match escaped characters
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Jan 29, 2020, 14:04 UTC
- Message-ID
- <c4f3b0d4-c837-bec7-7ad2-2203bb577b17@gmail.com>
- In-Reply-To
- <6003bbf2-ad16-0686-dc58-2010fe02ce05@gmail.com>
On 1/29/2020 8:58 AM, Derrick Stolee wrote:
Show 15 quoted lines
> On 1/29/2020 5:03 AM, Jeff King wrote: >> On Tue, Jan 28, 2020 at 06:26:40PM +0000, Derrick Stolee via GitGitGadget wrote: >> >>> From: Derrick Stolee <dstolee@microsoft.com> >>> >>> In cone mode, the sparse-checkout feature uses hashset containment >>> queries to match paths. Make this algorithm respect escaped asterisk >>> (*) and backslash (\) characters. >> >> Do we also need to worry about other glob metacharacters? E.g., "?" or >> ranges like "[A-Z]"? > > These are not part of the .gitignore patterns [1]. > > [1] https://git-scm.com/docs/gitignore#_pattern_format
I should read things more carefully. There is also this information in one of the bullets:
An asterisk "*" matches anything except a slash. The character "?" matches any one character except "/". The range notation, e.g. [a-zA-Z], can be used to match one of the characters in a range. See fnmatch(3) and the FNM_PATHNAME flag for a more detailed description.
So this series does not attempt to properly work with globs, and I'll need to test those a bit. Certainly they shouldn't work in cone mode, so an extra patch to remove those would be simple. Input sanitizing would be interesting, and I'll see what `git ls-tree` would output with paths containing these characters.
-Stolee