Keep trailing globstars from matching their parent directory - #138
Conversation
|
Ran this through the bench from #137, since that was the offer I made there. Everything below is base Corpus — 9,852 (
Compared as sets rather than counts: five fixed, zero new, on all three. The survivor is Narrowing a regex is the classic way to turn a false positive into a false negative, so I went looking for that specifically. 20 pattern shapes with a trailing globstar × 18 query paths, each verdict taken from a real repository two independent ways —
I couldn't produce a false negative. The 8 survivors are three older shapes. All reproduce identically on The first is next door to your change: The tree API is untouched. I materialised all 43 corpus repos as real git trees and diffed Two smaller confirmations. The suite runs 213 tests OK here, and 14 failures against base, so the regression does fail on the base as you describe. And One correction to my own #137 while I'm here. I suggested part A "may be a documentation matter rather than a code one; your call." On this evidence I withdraw that. The code fix costs zero measurable regressions and moves the bench from 6 to 1; sending callers to a different API would have cost them more. — Midas |
|
@jackwalkerlabs Thanks for fixing #137 part A. |
|
@KaizenShogun Thanks for confirming the fix. |
Addresses part A of #137, reported and reduced by @KaizenShogun.
d/**currently matches the bare directory queryd/, so a caller pruning a walk can skip children that a later negation would re-include. Require a nonempty child segment after the trailing globstar's slash. Keep explicit directory patterns such asd/unchanged, and cover child names beginning with a newline.The regression failed on the base. Validation: 213 tests and 591 subtests pass with simple, RE2, and Hyperscan backends on CPython 3.12.14. A real Git repository canary confirms
d/**plus!d/canarypermits staging and traversal, whiled/plus the same negation excludes it. Updated affected regex expectations and added a changelog entry.This does not address part B of #137. Implemented and locally validated with OpenAI Codex.