Documentation
¶
Overview ¶
Package git wraps the system git binary for worktrees, branches and status.
Implemented in P1; see docs/PLAN.md.
Index ¶
- Constants
- Variables
- func Commits(ctx context.Context, path, base string) (string, error)
- func Context(ctx context.Context, path, base string) (string, error)
- func Head(ctx context.Context, path string) (string, error)
- func PromptCredential(ctx context.Context, prompt string) (string, error)
- func Push(ctx context.Context, path, branch string) error
- func RunAskpass(args []string, out io.Writer) (handled bool, code int)
- func WithCredentialPrompt(ctx context.Context, prompt CredentialPrompt) context.Context
- type CredentialPrompt
- type DiffResult
- type Repo
- func (r Repo) CheckpointCommitted(ctx context.Context, path string, c portable.Checkpoint) error
- func (r Repo) CleanupCheck(ctx context.Context, path, branch, base, mergedHead string) error
- func (r Repo) Commit(ctx context.Context, ref string) (string, error)
- func (r Repo) CreateWorktree(ctx context.Context, spec WorktreeSpec) error
- func (r Repo) EnablePortable(worktree string) error
- func (r Repo) FinishCleanup(ctx context.Context, branch string, id int64, force bool, mergedHead string) error
- func (r Repo) HasCheckpoint(ctx context.Context, tip string, c portable.Checkpoint) bool
- func (r Repo) IsAncestor(ctx context.Context, before, after string) bool
- func (r Repo) Key() string
- func (r Repo) PRBase(ctx context.Context, base string) (string, error)
- func (r Repo) PreserveHead(ctx context.Context, path string, id int64) (string, error)
- func (r Repo) ProvisionWorktree(ctx context.Context, spec WorktreeSpec, start int, advance func(int) error) error
- func (r Repo) RecreateWorktree(ctx context.Context, path, branch, commit string) error
- func (r Repo) RemoveWorktree(ctx context.Context, path, branch, head string, force, merged bool) error
- func (r Repo) RestoreWorktree(ctx context.Context, path, branch, commit, ref string) error
- func (r Repo) StableBase(ctx context.Context, base string) (string, error)
- func (r Repo) TaskCheckpoints(ctx context.Context, only string) ([]TaskCheckpoint, error)
- func (r Repo) TaskWorktree(ctx context.Context, branch string) (string, error)
- func (r Repo) ValidateTaskCheckout(ctx context.Context, path, branch string) error
- func (r Repo) ValidateWorktree(ctx context.Context, path, branch string) error
- type Status
- type TaskCheckpoint
- type WorktreeSpec
Constants ¶
const MaxDiffBytes = 2 << 20
Variables ¶
var ErrCredentialCanceled = errors.New("git authentication canceled")
Functions ¶
func PromptCredential ¶ added in v1.0.0
PromptCredential forwards an IPC credential challenge to the current caller.
func RunAskpass ¶ added in v0.0.6
RunAskpass handles invocations of this executable by Git or OpenSSH. Secrets travel over a temporary loopback connection, never arguments or files.
func WithCredentialPrompt ¶ added in v0.0.6
func WithCredentialPrompt(ctx context.Context, prompt CredentialPrompt) context.Context
WithCredentialPrompt routes Git and SSH askpass requests to the caller.
Types ¶
type CredentialPrompt ¶ added in v0.0.6
type DiffResult ¶ added in v0.0.5
DiffResult compares the base commit with the tracked working tree, including both staged and unstaged edits. Untracked paths are listed separately.
func WorktreeDiff ¶ added in v0.0.5
func WorktreeDiff(ctx context.Context, path, base string) (DiffResult, error)
type Repo ¶
type Repo struct{ Root, CommonDir, Remote, DefaultBranch string }
func Discover ¶
Discover resolves linked worktrees to the main checkout, so all tabs in the same repository share a project identity and lock.
func (Repo) CheckpointCommitted ¶ added in v1.0.0
func (Repo) CleanupCheck ¶ added in v0.0.5
CleanupCheck checks against the actual remote branch, rather than a potentially stale upstream tracking ref. A merged PR's exact head is also proof of upload.
func (Repo) CreateWorktree ¶
func (r Repo) CreateWorktree(ctx context.Context, spec WorktreeSpec) error
func (Repo) EnablePortable ¶ added in v1.0.0
EnablePortable replaces only Maestro's exact generated legacy ignore block. Legacy custom-agent files remain ignored; only checkpoint paths are exposed.
func (Repo) FinishCleanup ¶ added in v0.0.5
func (r Repo) FinishCleanup(ctx context.Context, branch string, id int64, force bool, mergedHead string) error
FinishCleanup resumes a removal interrupted between Git and SQLite updates.
func (Repo) HasCheckpoint ¶ added in v1.0.0
HasCheckpoint proves checkpoint ancestry from published file history, not from a local code commit that may predate an unpublished checkpoint.
func (Repo) IsAncestor ¶ added in v1.0.0
func (Repo) PRBase ¶ added in v0.0.5
PRBase resolves named local/remote bases; commit-only tasks must supply a base.
func (Repo) PreserveHead ¶ added in v0.0.5
PreserveHead protects the local commits from garbage collection even after a squash merge, force cleanup, or deletion of the remote task branch.
func (Repo) ProvisionWorktree ¶ added in v0.0.5
func (r Repo) ProvisionWorktree(ctx context.Context, spec WorktreeSpec, start int, advance func(int) error) error
ProvisionWorktree resumes copies/setup at start. advance persists the next step after each success. Failed setup retains the worktree for inspection.
func (Repo) RecreateWorktree ¶ added in v0.0.5
func (Repo) RemoveWorktree ¶ added in v0.0.5
func (Repo) RestoreWorktree ¶ added in v1.0.0
RestoreWorktree attaches an existing branch or creates it from the fetched commit. Never resets branches or runs repository setup commands on discovery.
func (Repo) StableBase ¶ added in v0.0.5
StableBase keeps named branches usable as comparison targets, while resolving checkout-relative revisions such as HEAD and HEAD~1 in the source checkout.
func (Repo) TaskCheckpoints ¶ added in v1.0.0
TaskCheckpoints only reads fetched/local branch tips, never contacting remotes. A manifest inherited by another branch is not that branch's task.
func (Repo) TaskWorktree ¶ added in v1.0.0
TaskWorktree returns an existing checkout for this branch, including the main checkout. Destructive cleanup continues to require ValidateWorktree.
func (Repo) ValidateTaskCheckout ¶ added in v1.0.0
type TaskCheckpoint ¶ added in v1.0.0
type TaskCheckpoint struct {
portable.Checkpoint
Ref, Commit string
}