Repository navigation
Commit 776d00f
committed
git: Allow MkdirAll on worktree-root paths
The worktree filesystem wrapper rejects `""`, `"."`, and `"/"` in
`MkdirAll` via `validPath`, even though `validReadPath` was already
relaxed to treat those paths as legitimate references to the worktree
root. The asymmetry was deliberate for genuine mutations — mutating
the root itself is not a sensible operation for `Create` or `Remove`
— but `MkdirAll` on an existing directory is not a mutation: it asks
the filesystem to ensure a directory exists, against one that always
does.
Short-circuit `MkdirAll` to a no-op for root-equivalents before
`validPath` runs. `validPath` itself stays strict, so the other
mutating operations continue to reject the root and the existing
`TestValidPath` table is untouched. A new
`TestWorktreeFilesystemMkdirAllRootIsNoop` locks in the no-op
contract against the wrapper.
Backport of #2115.
Assisted-by: Claude Opus 4.7
Signed-off-by: Hidde Beydals <[email protected]>1 parent 3235bb6 commit 776d00f
2 files changed
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
3193 | 3194 | | |
3194 | 3195 | | |
3195 | 3196 | | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
3196 | 3222 | | |
3197 | 3223 | | |
3198 | 3224 | | |
| |||
0 commit comments