Versions in this module Expand all Collapse all v0 v0.0.1 Jun 2, 2026 Changes in this version + var ErrConflict = errors.New("patchapply: hunk does not apply") + var ErrExists = errors.New("patchapply: file already exists") + var ErrMissing = errors.New("patchapply: target file not found") + var ErrUnsafePath = errors.New("patchapply: unsafe path") + func ApplyToBytes(orig []byte, f mailpatch.FileChange) ([]byte, error) + type DirFS struct + func NewDirFS(dir string) *DirFS + func (d *DirFS) Exists(name string) bool + func (d *DirFS) ReadFile(name string) ([]byte, error) + func (d *DirFS) Remove(name string) error + func (d *DirFS) WriteFile(name string, data []byte, perm fs.FileMode) error + type FS interface + Exists func(name string) bool + ReadFile func(name string) ([]byte, error) + Remove func(name string) error + WriteFile func(name string, data []byte, perm fs.FileMode) error + type FileResult struct + Hunks int + OldPath string + Path string + Status Status + type MemFS struct + func NewMemFS(initial map[string][]byte) *MemFS + func (m *MemFS) Exists(name string) bool + func (m *MemFS) Files() map[string][]byte + func (m *MemFS) ReadFile(name string) ([]byte, error) + func (m *MemFS) Remove(name string) error + func (m *MemFS) WriteFile(name string, data []byte, _ fs.FileMode) error + type Options struct + DryRun bool + Reverse bool + type PathError struct + Err error + Path string + func (e *PathError) Error() string + func (e *PathError) Unwrap() error + type Result struct + Files []FileResult + func Apply(fsys FS, files []mailpatch.FileChange, opts *Options) (*Result, error) + func ApplyDiff(fsys FS, diff string, opts *Options) (*Result, error) + func ApplyPatch(fsys FS, p *mailpatch.Patch, opts *Options) (*Result, error) + type Status int + const Created + const Removed + const Renamed + const Updated + func (s Status) String() string