On 1/14/2020 4:21 PM, Jeff King wrote: > On Tue, Jan 14, 2020 at 07:26:01PM +0000, Derrick Stolee via GitGitGadget wrote: > >> From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> >> >> In cone mode, the sparse-checkout feature uses hashset containment >> queries to match paths. Make this algorithm respect escaped asterisk >> (*) and backslash (\) characters. >> >> Create dup_and_filter_pattern() method to convert a pattern by >> removing escape characters and dropping an optional "/*" at the end. >> This method is available in dir.h as we will use it in >> builtin/sparse-chekcout.c in a later change. > > s/chekcout/checkout/ Thanks. > It took me a minute to understand the problem here, but I think it's: if > a path in the sparse-checkout file has "\*" in it, we'd try to match a > literal "\*" in the hash, not "*"? Yes, the hashset would have the string "\*" instead of the string "*". This would lead to missing directories when cone mode is enabled compared to cone mode not being enabled. > But we wouldn't run into that yet because we don't properly _write_ the > escaped names until patch 8. We wouldn't run into it when using the builtin, but also a user could edit their sparse-checkout file manually OR figure out how to get the "right" pattern by running "git sparse-checkout set "my\\*dir" (where the escaped backslash is collapsed by the shell and Git sees "my\*dir". Thanks, -Stolee