worktreeFilesystem wraps a billy.Filesystem and validates every path passed to a mutating operation. This prevents writing to, or deleting from, dangerous locations (e.g. .git/*, ../) regardless of which worktree code path triggers the operation.
| 40 | // dangerous locations (e.g. .git/*, ../) regardless of which worktree |
| 41 | // code path triggers the operation. |
| 42 | type worktreeFilesystem struct { |
| 43 | billy.Filesystem |
| 44 | protectNTFS bool |
| 45 | protectHFS bool |
| 46 | } |
| 47 | |
| 48 | func newWorktreeFilesystem(fs billy.Filesystem, protectNTFS, protectHFS bool) *worktreeFilesystem { |
| 49 | return &worktreeFilesystem{Filesystem: fs, protectNTFS: protectNTFS, protectHFS: protectHFS} |
nothing calls this directly
no outgoing calls
no test coverage detected