Documentation
¶
Overview ¶
Package snapshot records workspace states in a shadow git repository.
Index ¶
- Variables
- type FileDiff
- type Manager
- type Patch
- type Repo
- func (r *Repo) Cleanup(ctx context.Context) error
- func (r *Repo) Diff(ctx context.Context, hash string) (string, error)
- func (r *Repo) DiffFull(ctx context.Context, from, to string) ([]FileDiff, error)
- func (r *Repo) Directory() string
- func (r *Repo) GitDir() string
- func (r *Repo) Patch(ctx context.Context, hash string) (Patch, error)
- func (r *Repo) Restore(ctx context.Context, hash string) error
- func (r *Repo) Revert(ctx context.Context, patches []Patch) error
- func (r *Repo) Track(ctx context.Context) (string, error)
- func (r *Repo) Worktree() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotGitRepository = errors.New("not a git repository")
ErrNotGitRepository means the requested directory is not inside a git worktree.
Functions ¶
This section is empty.
Types ¶
type FileDiff ¶
type FileDiff struct {
File string `json:"file"`
Patch string `json:"patch"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Status string `json:"status,omitempty"`
}
FileDiff describes one file in a diff between two snapshot tree hashes.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager opens per-worktree shadow repositories under a data directory.
func NewManager ¶
NewManager creates a snapshot manager rooted at dataDir.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is a shadow git repository paired with a source worktree.
Click to show internal directories.
Click to hide internal directories.