You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add .. (parent-directory) support to relative path resolution
#include directives, TEST_SOURCE_FILE(), and CLI `test:` task names got
proper relative-path handling and duplicate-filename disambiguation in a
recent refactor, but none of it accounted for `..`. A `..`-containing query
was silently treated as an ordinary path segment that could never match any
real project file, degrading to a plain not-found rather than naming `..`
as the actual problem.
PathMatcher gains `resolve_relative(query, anchor:)`, collapsing a query's
own `..` against an anchor directory (or raising a clear, specific error
when no anchor exists, or when traversal would go outside the project).
Six call sites needed it, not the three originally expected -- three
distinct #include extraction pipelines (GCC's own directives-only output,
the text-scan fallback, and TestContextExtractor's always-on scan) each
independently construct Include objects from literal, unresolved directive
text and needed their own anchoring. That repeated reconstruction logic is
now consolidated into one `Include#anchored(anchor)` on the base class.
CLI test: task names have no file of their own to anchor a `..` against,
so one is deliberately left unsupported there, with a named error instead
of a generic not-found.
Also folds `Includes.paths_correspond?`'s own segment-tail-matching into
`PathMatcher.correspond?`, removing a second, independent reimplementation
of the same comparison PathMatcher already provided.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments