Documentation
¶
Index ¶
- Constants
- Variables
- type CompareResult
- type DiffLayer
- type FileDiff
- type FileStatus
- type GitBranch
- type GitCommit
- type GitFileStatus
- type GitStatus
- type Manager
- func (m *Manager) Branches(ctx context.Context, refresh bool) ([]GitBranch, string, error)
- func (m *Manager) CheckoutBranch(ctx context.Context, name, remote string) error
- func (m *Manager) Close()
- func (m *Manager) Commit(ctx context.Context, message string) (string, error)
- func (m *Manager) Compare(ctx context.Context, base, head string, mergeBase bool) (CompareResult, error)
- func (m *Manager) CreateBranch(ctx context.Context, name string) error
- func (m *Manager) Diff(ctx context.Context, path string, layer DiffLayer) (FileDiff, error)
- func (m *Manager) Diffs(ctx context.Context) ([]FileDiff, error)
- func (m *Manager) DiffsLayer(ctx context.Context, layer DiffLayer) ([]FileDiff, error)
- func (m *Manager) Fingerprint(ctx context.Context) uint64
- func (m *Manager) GitStatus(ctx context.Context) (GitStatus, error)
- func (m *Manager) History(ctx context.Context) ([]GitCommit, error)
- func (m *Manager) HistoryLimit(ctx context.Context, limit int) ([]GitCommit, error)
- func (m *Manager) Pull(ctx context.Context) (string, error)
- func (m *Manager) Push(ctx context.Context) (string, error)
- func (m *Manager) Revert(ctx context.Context, path string) error
- func (m *Manager) Stage(ctx context.Context, paths []string) error
- func (m *Manager) Unstage(ctx context.Context, paths []string) error
Constants ¶
const EmptyTreeRevision = ":empty"
EmptyTreeRevision is the API-only base used to show the contents introduced by a repository's root commit.
const WorktreeRevision = ":worktree"
WorktreeRevision is the API-only revision used to compare a commit with the current index and filesystem state. A colon cannot appear in a Git ref name, so it cannot shadow a real branch or tag.
Variables ¶
var ErrClosed = errors.New("change tracker closed")
var ErrDirtyWorktree = errors.New("local changes can only move between branches at the same commit; clean the worktree before switching to a divergent branch")
var ErrNoDiff = errors.New("diff not found")
var ErrNotGitRepository = errors.New("workspace is not a Git repository")
Functions ¶
This section is empty.
Types ¶
type CompareResult ¶ added in v0.14.2
type FileStatus ¶
type FileStatus int
const ( StatusAdded FileStatus = iota StatusModified StatusDeleted )
type GitFileStatus ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) CheckoutBranch ¶
func (*Manager) Compare ¶ added in v0.14.2
func (m *Manager) Compare(ctx context.Context, base, head string, mergeBase bool) (CompareResult, error)
Compare returns committed file changes from base to head. When mergeBase is true, the base tree is replaced with the commits' common ancestor, matching the three-dot comparison used for pull request file views.
func (*Manager) CreateBranch ¶
func (*Manager) DiffsLayer ¶ added in v0.15.1
DiffsLayer returns a consistent snapshot of every change in one Git layer. The manager lock stays held while the status, HEAD tree, and file contents are read so callers such as commit-message generation never mix snapshots.
func (*Manager) History ¶ added in v0.14.2
History returns commits reachable from all local and remote refs. Ref labels are attached to their tip commits so the UI can render a compact history tree.
func (*Manager) HistoryLimit ¶ added in v0.15.1
HistoryLimit returns at most limit commits, or the complete history when limit is zero. Commits are ordered by committer time, newest first.