sparse-checkout: cone mode does not recognize "**"
commit41de0c6fbcc3d2544ebada3a9f26dec0f32f42de
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 24 Jan 2020 21:19:36 +0000 (24 21:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jan 2020 21:26:54 +0000 (24 13:26 -0800)
tree3b9147a8baec6ddb105d107bd9b1000da70e1abe
parent7aa9ef2fcaa986d7f11064adab6d1c010d4f2ead
sparse-checkout: cone mode does not recognize "**"

When core.sparseCheckoutCone is enabled, the 'git sparse-checkout set'
command creates a restricted set of possible patterns that are used
by a custom algorithm to quickly match those patterns.

If a user manually edits the sparse-checkout file, then they could
create patterns that do not match these expectations. The cone-mode
matching algorithm can return incorrect results. The solution is to
detect these incorrect patterns, warn that we do not recognize them,
and revert to the standard algorithm.

Check each pattern for the "**" substring, and revert to the old
logic if seen. While technically a "/<dir>/**" pattern matches
the meaning of "/<dir>/", it is not one that would be written by
the sparse-checkout builtin in cone mode. Attempting to accept that
pattern change complicates the logic and instead we punt and do
not accept any instance of "**".

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c
t/t1091-sparse-checkout-builtin.sh