validReadPath is like validPath but treats the empty string and "." as valid references to the worktree root. Read-side operations on the root (e.g. ReadDir(""), Lstat(".")) are legitimate; mutating the root itself is not, so write-side operations continue to use validPath directly.
(p string)
| 153 | // (e.g. ReadDir(""), Lstat(".")) are legitimate; mutating the root itself |
| 154 | // is not, so write-side operations continue to use validPath directly. |
| 155 | func (sfs *worktreeFilesystem) validReadPath(p string) error { |
| 156 | if p == "" || p == "." || p == "/" { |
| 157 | return nil |
| 158 | } |
| 159 | return sfs.validPath(p) |
| 160 | } |
| 161 | |
| 162 | var errUnsupportedOperation = errors.New("unsupported operation") |
| 163 |