Commit afdb4f9
committed
[STEP-2135] Allow non-existent paths in compat FilterPaths
v1 pathutil.FilterPaths did not touch the filesystem, so callers could
filter synthetic or relative paths that do not exist on disk. The v2
compat adapter was stat-ing every path up-front, which surfaced a
not-exist error and broke drop-in migration for call sites that feed
lexical inputs (e.g. steps-cocoapods-install main_test.go).
Stat opportunistically instead: if the path does not exist, fall through
with a nil DirEntry. Purely path-based filters (Base, Extension, Regexp,
Component, ComponentWithExtension, InDirectory) keep working unchanged;
filters that consult the DirEntry (IsDirectory, DirectoryContainsFile,
FileContains) still error when the DirEntry is needed but unavailable.
Stat errors other than ErrNotExist continue to surface.
Tests split: one covering the v1-parity lexical case, one asserting the
DirEntry-needing filter still errors on a missing path.1 parent fd3b781 commit afdb4f9
2 files changed
Lines changed: 26 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
20 | 24 | | |
21 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | | - | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
| |||
0 commit comments