Documentation
¶
Overview ¶
[INPUT]: Git refs/heads and refs/remotes via Runner.Read; Git's branch validation and mutation semantics. [OUTPUT]: Branch/RemoteBranch models, local and remote-tracking ref discovery, safe switch/create. [POS]: Git domain reference boundary, read-only remote enumeration never contacts network. [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
Package gitworkbench owns Solco's local Git review model: one command runner, repository facts, working-tree change snapshots, a clean-room patch parser, word diff, changed-file trees, commit transactions and branch switching. It supersedes internal/gitintel as the single Git cache.
Hard rules:
- every Git invocation is argv-based through exec.CommandContext; never a shell string;
- reads carry bounded time/output and never mutate;
- mutations (add/commit/switch) are single-flight per repository root and run only on explicit user intent;
- no automatic network fetch, no force, no reset --hard, no clean;
- errors classify by operation class; stderr text stays in the returned error for the UI but is never logged with file/commit content by this package.
Index ¶
- Constants
- Variables
- func CommitMessagePrompt(snap *ChangesSnapshot, selected []string) string
- func EnsureAncestorsOpen(collapsed map[string]bool, path string)
- func Explain(err error) string
- func IsGenerated(path string) bool
- func LinePatch(path string, h Hunk, selected map[int]bool, unstage bool) (string, bool)
- func LocalChangesBlocked(err error) bool
- type AutostashResult
- type BlameLine
- type Branch
- type Cache
- type ChangeFile
- type ChangeStatus
- type ChangesSnapshot
- type CommitDraft
- type CommitInfo
- type CommitPreflight
- type CommitPromptPreview
- type CommitRef
- type CommitRefKind
- type CommitResult
- type ConflictSide
- type DiffLine
- type ErrClass
- type Error
- type FileDiff
- type FlatRow
- type GraphQuery
- type Hunk
- type LineKind
- type OpClass
- type PullMode
- type PushKind
- type PushOffer
- type PushRef
- type RebaseAction
- type RebaseCommit
- type RebaseStep
- type ReflogEntry
- type Remote
- type RemoteBranch
- type RepoFacts
- type ResetMode
- type Runner
- func (r *Runner) AddRemote(ctx context.Context, root, name, url string) error
- func (r *Runner) AddSubmodule(ctx context.Context, root, address, rel string) error
- func (r *Runner) AddWorktree(ctx context.Context, root, path string) error
- func (r *Runner) ApplyLines(ctx context.Context, root, path string, h Hunk, selected map[int]bool, ...) error
- func (r *Runner) ApplyPatch(ctx context.Context, root, file string) error
- func (r *Runner) Blame(ctx context.Context, root, rev, rel string) ([]BlameLine, error)
- func (r *Runner) BlobSize(ctx context.Context, root, spec string) (int64, error)
- func (r *Runner) BranchUpstream(ctx context.Context, root, branch string) string
- func (r *Runner) CapturePreflight(ctx context.Context, root string, snap *ChangesSnapshot, selected []string) (CommitPreflight, error)
- func (r *Runner) CheckoutDetached(ctx context.Context, root, hash string) error
- func (r *Runner) CheckoutRemoteBranch(ctx context.Context, root, ref string) (SwitchResult, error)
- func (r *Runner) CherryPickCommit(ctx context.Context, root, hash string) error
- func (r *Runner) Commit(ctx context.Context, root string, draft CommitDraft, pre CommitPreflight, ...) (CommitResult, error)
- func (r *Runner) CommitByHash(ctx context.Context, root, hash string) (*CommitInfo, error)
- func (r *Runner) CommitMessage(ctx context.Context, root, hash string) (string, error)
- func (r *Runner) CommitSnapshot(ctx context.Context, root, hash string) (*ChangesSnapshot, error)
- func (r *Runner) CompareToWorktree(ctx context.Context, root, hash string) (*ChangesSnapshot, error)
- func (r *Runner) CreateBranch(ctx context.Context, root, name string) (SwitchResult, error)
- func (r *Runner) CreateBranchAt(ctx context.Context, root, name, hash string) (SwitchResult, error)
- func (r *Runner) CreateTag(ctx context.Context, root, name string) error
- func (r *Runner) CreateTagAnnotated(ctx context.Context, root, name, hash, message string) error
- func (r *Runner) CreateTagAt(ctx context.Context, root, name, hash string) error
- func (r *Runner) CurrentBranch(ctx context.Context, root string) string
- func (r *Runner) DefaultRemote(ctx context.Context, root string) string
- func (r *Runner) DeleteBranch(ctx context.Context, root, name string) error
- func (r *Runner) DeleteRemoteBranch(ctx context.Context, root, remote, name string) error
- func (r *Runner) DeleteRemoteTag(ctx context.Context, root, remote, name string) error
- func (r *Runner) DeleteTag(ctx context.Context, root, name string) error
- func (r *Runner) DeleteUntracked(root string, paths []string) error
- func (r *Runner) Discard(ctx context.Context, root string, paths []string) error
- func (r *Runner) Facts(ctx context.Context, root string) (RepoFacts, error)
- func (r *Runner) Fetch(ctx context.Context, root, remote string) error
- func (r *Runner) FetchAll(ctx context.Context, root string, prune bool) error
- func (r *Runner) FetchedAt(ctx context.Context, root string) (at time.Time, ok bool)
- func (r *Runner) FileHistory(ctx context.Context, root, rel string, limit int) ([]CommitInfo, error)
- func (r *Runner) FileLines(ctx context.Context, root, relPath string, start, count int) ([]string, error)
- func (r *Runner) FinishSequencer(ctx context.Context, root string, expected SequencerKind, abort bool) error
- func (r *Runner) FormatPatch(ctx context.Context, root, hash string) ([]byte, error)
- func (r *Runner) GraphPosition(ctx context.Context, root string, q GraphQuery, hash string) (int, error)
- func (r *Runner) InteractiveRebase(ctx context.Context, root, base string, steps []RebaseStep) error
- func (r *Runner) LastCommitMessage(ctx context.Context, root string) (subject, body string, err error)
- func (r *Runner) ListBranches(ctx context.Context, root string) ([]Branch, error)
- func (r *Runner) ListCommitGraph(ctx context.Context, root string, q GraphQuery) ([]CommitInfo, error)
- func (r *Runner) ListCommits(ctx context.Context, root string, limit int) ([]CommitInfo, error)
- func (r *Runner) ListRemoteBranches(ctx context.Context, root string) ([]RemoteBranch, error)
- func (r *Runner) ListRemotes(ctx context.Context, root string) ([]Remote, error)
- func (r *Runner) ListSubmodules(ctx context.Context, root string) ([]Submodule, error)
- func (r *Runner) ListTags(ctx context.Context, root string) ([]Tag, error)
- func (r *Runner) ListTree(ctx context.Context, root, rev, dir string) ([]TreeEntry, error)
- func (r *Runner) ListWorktrees(ctx context.Context, root string) ([]Worktree, error)
- func (r *Runner) LockRepo(root, op string) (func(), error)
- func (r *Runner) MergeFastForward(ctx context.Context, root, target string) error
- func (r *Runner) MergeInProgress(ctx context.Context, root string) bool
- func (r *Runner) MergeNoFastForward(ctx context.Context, root, target string) error
- func (r *Runner) MergeSquash(ctx context.Context, root, target string) error
- func (r *Runner) Mutate(ctx context.Context, root string, args ...string) ([]byte, error)
- func (r *Runner) Pull(ctx context.Context, root, remote, branch string, mode PullMode) error
- func (r *Runner) PullFFOnly(ctx context.Context, root, remote, branch string) error
- func (r *Runner) Push(ctx context.Context, root, remote, branch string, setUpstream bool) error
- func (r *Runner) PushMany(ctx context.Context, root, remote string, refs []PushRef, setUpstream bool) error
- func (r *Runner) PushTag(ctx context.Context, root, remote, name string) error
- func (r *Runner) PushTo(ctx context.Context, root, remote, src, dst string, setUpstream bool) error
- func (r *Runner) Read(ctx context.Context, root string, args ...string) ([]byte, error)
- func (r *Runner) ReadBlob(ctx context.Context, root, spec string, max int64) ([]byte, error)
- func (r *Runner) ReadFileDiff(ctx context.Context, root, base string, cf ChangeFile) (FileDiff, error)
- func (r *Runner) ReadPushOffer(ctx context.Context, root, remote string) (PushOffer, error)
- func (r *Runner) RebaseOnto(ctx context.Context, root, target string) error
- func (r *Runner) RebasePlan(ctx context.Context, root, base string) ([]RebaseCommit, error)
- func (r *Runner) Reflog(ctx context.Context, root string, limit int) ([]ReflogEntry, error)
- func (r *Runner) RemoveRemote(ctx context.Context, root, name string) error
- func (r *Runner) RemoveSubmodule(ctx context.Context, root, rel string) error
- func (r *Runner) RemoveWorktree(ctx context.Context, root, path string) error
- func (r *Runner) RenameBranch(ctx context.Context, root, name, to string) error
- func (r *Runner) RenameRemote(ctx context.Context, root, name, to string) error
- func (r *Runner) RequireCleanWorktree(ctx context.Context, root string) error
- func (r *Runner) ResetTo(ctx context.Context, root, hash string, mode ResetMode) (previous string, err error)
- func (r *Runner) ResolveCommit(ctx context.Context, root, fullRef string) (string, error)
- func (r *Runner) ResolveConflict(ctx context.Context, root, rel string, side ConflictSide) error
- func (r *Runner) ResolveRoot(ctx context.Context, dir string) (string, error)
- func (r *Runner) RestoreFile(ctx context.Context, root, hash, rel string) error
- func (r *Runner) RevertCommit(ctx context.Context, root, hash string) error
- func (r *Runner) SequencerState(ctx context.Context, root string) (SequencerStatus, error)
- func (r *Runner) SetRemoteURL(ctx context.Context, root, name, url string) error
- func (r *Runner) SetUpstream(ctx context.Context, root, branch, upstream string) error
- func (r *Runner) Snapshot(ctx context.Context, root string) (*ChangesSnapshot, error)
- func (r *Runner) Stage(ctx context.Context, root string, paths []string) error
- func (r *Runner) StashApply(ctx context.Context, root, ref string) error
- func (r *Runner) StashClear(ctx context.Context, root string) error
- func (r *Runner) StashDrop(ctx context.Context, root, ref string) error
- func (r *Runner) StashList(ctx context.Context, root string) ([]Stash, error)
- func (r *Runner) StashPatch(ctx context.Context, root, ref string) ([]byte, error)
- func (r *Runner) StashPop(ctx context.Context, root, ref string) error
- func (r *Runner) StashPush(ctx context.Context, root, message string) error
- func (r *Runner) StashPushPaths(ctx context.Context, root, message string, paths []string) error
- func (r *Runner) StashRename(ctx context.Context, root, hash, message string) error
- func (r *Runner) StashSnapshot(ctx context.Context, root, hash string) (*ChangesSnapshot, error)
- func (r *Runner) Stdin(ctx context.Context, root, stdin string, args ...string) ([]byte, error)
- func (r *Runner) SwitchBranch(ctx context.Context, root, name string) (SwitchResult, error)
- func (r *Runner) UndoLastCommit(ctx context.Context, root string) error
- func (r *Runner) UnmergedPaths(ctx context.Context, root string) ([]string, error)
- func (r *Runner) UnsetUpstream(ctx context.Context, root, branch string) error
- func (r *Runner) Unstage(ctx context.Context, root string, noHead bool, paths []string) error
- func (r *Runner) UpdateSubmodule(ctx context.Context, root, rel string) error
- func (r *Runner) Upstream(ctx context.Context, root string) (UpstreamStatus, error)
- func (r *Runner) ValidateBranchName(ctx context.Context, root, name string) error
- func (r *Runner) WithAutostash(ctx context.Context, root string, action func() error) (AutostashResult, error)
- func (r *Runner) WorkingPatch(ctx context.Context, root string) ([]byte, error)
- type SequencerKind
- type SequencerStatus
- type Stash
- type Submodule
- type SubmoduleState
- type SwitchResult
- type Tag
- type TreeEntry
- type TreeNode
- type UpstreamStatus
- type WebRepo
- type WordRange
- type Worktree
Constants ¶
const ( RefHeadsPrefix = "refs/heads/" RefRemotesPrefix = "refs/remotes/" RefTagsPrefix = "refs/tags/" )
Ref namespaces the graph reads. A hidden ref is always a full name.
const ( // ReadTimeout is the hard deadline for one read command. ReadTimeout = 5 * time.Second // MutateTimeout bounds one mutation (commit hooks may be slow). MutateTimeout = 30 * time.Second // MaxReadOutput bounds captured stdout of one read command. MaxReadOutput = 32 << 20 // 32 MiB // MaxSnapshotBytes is the whole-snapshot memory budget; a snapshot that // would exceed it degrades (TooLarge / Truncated), never freezes. MaxSnapshotBytes = 64 << 20 // 64 MiB // MaxPatchBytesPerFile bounds the rendered patch retained per file. MaxPatchBytesPerFile = 4 << 20 // 4 MiB // MaxUntrackedFiles bounds individually listed untracked entries. MaxUntrackedFiles = 1000 // LargeDiffLines is the changed-line count (additions plus deletions) // past which a file's diff waits behind a Show button instead of being // read, parsed and drawn with the rest of the review. LargeDiffLines = 5000 // MaxOnDemandPatchBytes bounds the diff of one file read when the user // opens it; past it the file is too large for the review. MaxOnDemandPatchBytes = 16 << 20 // 16 MiB // OnDemandTimeout is the deadline of that read. OnDemandTimeout = 20 * time.Second )
Policy bounds for Git subprocess work (plan §13/§15/§35).
const ( // MaxWordDiffRunes caps one input line's participation in word diffing. MaxWordDiffRunes = 2000 // MaxWordDiffProduct caps tokensOld*tokensNew against pathological cost. MaxWordDiffProduct = 250000 // MaxWordDiffRewriteRatio suppresses marks when lines are mostly // rewritten (noisy word marks on unrelated lines hurt review). MaxWordDiffRewriteRatio = 0.72 )
Word diff bounds (plan §18): presentation-only ranges, never Git authority.
const AutostashMessage = "Solco autostash"
AutostashMessage labels the temporary stash so a kept one is recognisable.
const MaxBlameLines = 5000
MaxBlameLines bounds one blame read.
const MaxCommitPromptBytes = maxCommitPreviewBytes
MaxCommitPromptBytes remains exported for callers that bound the legacy prompt. The canonical Preview path is always at or below this limit.
const MaxContextWindowBytes = 1 << 20 // 1 MiB
MaxContextWindowBytes bounds one context-expansion read.
const MaxGraphLimit = 20000
MaxGraphLimit is the largest window a graph read may ask for.
const MaxPatchFileBytes = 8 << 20
MaxPatchFileBytes bounds a patch file Solco will apply.
const MaxPushRefs = 200
MaxPushRefs bounds one multi-ref push.
const MaxRebaseCommits = 100
MaxRebaseCommits bounds a plan.
const MaxReflogEntries = 300
MaxReflogEntries bounds the reflog list.
const NetworkTimeout = 120 * time.Second
NetworkTimeout bounds one explicit network operation (fetch/pull/push).
const StaleAfter = 30 * time.Second
StaleAfter is the stale-while-refresh threshold.
Variables ¶
var ErrStale = errors.New("review snapshot is stale: repository changed since review")
ErrStale is returned when the repository moved between review and commit; the UI must re-review, never auto-commit.
Functions ¶
func CommitMessagePrompt ¶
func CommitMessagePrompt(snap *ChangesSnapshot, selected []string) string
CommitMessagePrompt returns a privacy-preserving, metadata-only prompt. For explicitly approved code snippets, use PrepareCommitPrompt with opt-in. Deprecated: prefer PrepareCommitPrompt, which exposes privacy exclusions.
func EnsureAncestorsOpen ¶
EnsureAncestorsOpen clears the collapsed marks on every directory above path so a freshly selected file's row is visible.
func Explain ¶
Explain says in one sentence why a Git network or merge command failed. It returns "" when err is not a Git failure with output to read.
func IsGenerated ¶
IsGenerated reports whether the path looks like generated/dependency output by the table above.
func LinePatch ¶
LinePatch builds the patch that stages — or, with unstage, takes back out of the index — only the selected lines of one hunk of a tracked file's text change. It is `git add -p`'s edit: lines outside the selection stay as they are on the side the patch is applied to.
Stage: h is a hunk of index→worktree and the patch is applied to the index as it is. An unselected addition is left out; an unselected deletion stays as context (the index keeps the line).
Unstage: h is a hunk of HEAD→index and the patch is applied in reverse to the index. An unselected addition stays as context (the index keeps it); an unselected deletion is left out (the index stays without it).
selected holds indices into h.Lines; only additions and deletions count. It returns false when the selection holds no change line.
func LocalChangesBlocked ¶
LocalChangesBlocked reports whether a Git failure is the refusal to touch the working tree because of local changes — the case "Stash and reapply" answers.
Types ¶
type AutostashResult ¶
type AutostashResult struct {
// Stashed is false when there was nothing to put away.
Stashed bool
// Kept is true when the changes could not be reapplied (conflicts with the
// action's result, or the action left the repository mid-operation) and
// stay in the stash.
Kept bool
}
AutostashResult says what became of the stashed changes.
type BlameLine ¶
type BlameLine struct {
Line int
Hash string
Short string
Author string
Time time.Time
Summary string
Text string
}
BlameLine is one line of a file with the commit that last wrote it.
type Branch ¶
type Branch struct {
Name string
Current bool
HeadShort string
Upstream string // what it tracks, "origin/main"; "" when nothing
}
Branch is one local branch of the repository (plan §23.1: local only in core 0.10; no remote management, no ahead/behind network calls).
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is the single per-process Git change cache, keyed by repo root. It supersedes internal/gitintel; no second Git cache may exist alongside.
func (*Cache) Get ¶
func (c *Cache) Get(root string) (*ChangesSnapshot, bool)
Get returns the cached snapshot and whether it is fresh enough to show without a refresh banner (StaleAfter since generation).
func (*Cache) Invalidate ¶
Invalidate drops one root (after mutations the caller refreshes directly).
func (*Cache) NeedsRefresh ¶
NeedsRefresh reports whether a background refresh is worth starting.
func (*Cache) Refresh ¶
Refresh acquires a new snapshot for root. Concurrent refreshes of one root share one call; the loser waits and receives the same result. The snapshot always lands in the cache; callers must still verify Root/Signature match their current context before swapping visible state.
type ChangeFile ¶
type ChangeFile struct {
Path string
OldPath string // rename/copy source
Status ChangeStatus
Additions int
Deletions int
Binary bool
Generated bool
Deferred bool // diff held back for its size: counts known, Patch/Hunks empty until ReadFileDiff
TooLarge bool // cannot be shown even on demand (untracked, past MaxOnDemandPatchBytes)
Untracked bool
Fingerprint string
Patch []byte // parsed-model source; nil when Deferred/TooLarge/Binary
Hunks []Hunk
Truncated bool // patch retained below full size
// Staged/Unstaged mark which sides of git's status carry the change,
// driving the Stage/Unstage file actions. Both false for untracked.
Staged bool
Unstaged bool
// StagedHunks and UnstagedHunks are the per-side parses (HEAD vs index,
// index vs worktree) behind the staged/unstaged split views; each nil
// when that side carries no change or the side patch failed.
StagedHunks []Hunk
UnstagedHunks []Hunk
}
ChangeFile models one changed path in the working tree (plan §16 model).
type ChangeStatus ¶
type ChangeStatus string
ChangeStatus is the coarse working-tree change kind for one path.
const ( StatusModified ChangeStatus = "modified" StatusAdded ChangeStatus = "added" StatusDeleted ChangeStatus = "deleted" StatusRenamed ChangeStatus = "renamed" StatusCopied ChangeStatus = "copied" StatusTypeChange ChangeStatus = "typechange" StatusConflicted ChangeStatus = "conflicted" StatusUntracked ChangeStatus = "untracked" )
func (ChangeStatus) Letter ¶
func (s ChangeStatus) Letter() string
Letter is the one-character status code used in tree rows (M/A/D/R/C/T/U/X).
type ChangesSnapshot ¶
type ChangesSnapshot struct {
Root string
Head string
Branch string
NoHead bool
Signature string
Files []ChangeFile
DiffBase string // revision the combined diffs compare: HEAD, the empty tree, or from..to of a commit
TotalAdditions int
TotalDeletions int
// Truncated marks whole-snapshot degradation (untracked > 1000 or the
// memory budget overflow); UI shows an explicit degraded note.
Truncated bool
TruncatedUntracked int
GeneratedAt time.Time
Err string
}
ChangesSnapshot is the immutable fact set for one repository root at one moment (plan §14/§21). Renders never recompute it; the cache owns refresh.
func (*ChangesSnapshot) ByPath ¶
func (s *ChangesSnapshot) ByPath(path string) (ChangeFile, bool)
ByPath returns the change record for path, if present.
type CommitDraft ¶
type CommitDraft struct {
Subject string
Body string
Paths []string
Amend bool
// NoVerify skips the pre-commit and commit-msg hooks (--no-verify);
// SignOff appends a Signed-off-by trailer (-s). Both are per commit.
NoVerify bool
SignOff bool
}
CommitDraft is the user-authored commit intent (plan §22): subject required, body optional, selected paths only. No AI generation in 0.10. Amend replaces the last commit instead of adding one; the caller prefills the message from LastCommitMessage.
type CommitInfo ¶
type CommitInfo struct {
Hash string // full hash
Short string
Subject string
Author string
Time time.Time
Parents []string // real Git ancestry for native graph projection
// Refs are the refs that point at this commit (graph reads only).
Refs []CommitRef
}
CommitInfo is one entry of the commit history.
type CommitPreflight ¶
type CommitPreflight struct {
Root string
Head string
Branch string
Signature string
// Fingerprints maps each selected path to the ChangeFile fingerprint the
// user reviewed (presentation cache identity).
Fingerprints map[string]string
// ContentIDs maps each selected path to its authoritative live content/object
// identity (blob hash via git hash-object, "deleted", or symlink target).
ContentIDs map[string]string
// Untracked marks paths that must be `git add`ed before the pathspec
// commit (untracked paths are invisible to `git commit -- <path>`).
Untracked map[string]bool
}
CommitPreflight is the stale-state fence captured at Commit-surface open and revalidated immediately before mutation (plan §22.3).
type CommitPromptPreview ¶
func PrepareCommitPrompt ¶
func PrepareCommitPrompt(snapshot *ChangesSnapshot, selected []string, includeExcerpt bool) CommitPromptPreview
PrepareCommitPrompt defaults to statistics, not source code. The user may explicitly allow excerpts, but secrets/credentials/config paths are always excluded; sensitive entries never appear in the copied prompt.
type CommitRef ¶
type CommitRef struct {
Kind CommitRefKind
Name string
Full string
Head bool // the checked-out branch ("HEAD -> name")
}
CommitRef is one ref pointing at a commit. Full is the whole name (the key a hide list uses); Name is the short form chips show.
type CommitRefKind ¶
type CommitRefKind string
CommitRefKind says which namespace a decoration came from.
const ( RefBranch CommitRefKind = "branch" RefRemote CommitRefKind = "remote" RefTag CommitRefKind = "tag" )
type CommitResult ¶
CommitResult is the verified outcome of one transaction.
type ConflictSide ¶
type ConflictSide string
ConflictSide is which version of a conflicted file to keep.
const ( // ConflictOurs keeps the current branch's version. ConflictOurs ConflictSide = "ours" // ConflictTheirs takes the incoming version. ConflictTheirs ConflictSide = "theirs" // ConflictMarked accepts the file as it is on disk (the user edited it). ConflictMarked ConflictSide = "marked" )
type DiffLine ¶
type DiffLine struct {
Kind LineKind
OldLine int // 1-based; 0 for pure additions
NewLine int // 1-based; 0 for pure deletions
Text string
NoNewline bool // "\ No newline at end of file" follows this line
}
DiffLine is one parsed line of a hunk (plan §16).
type ErrClass ¶
type ErrClass string
ErrClass is a coarse, UI-safe classification of a Git failure.
const ( ErrGitMissing ErrClass = "git_missing" ErrNotARepo ErrClass = "not_a_repo" ErrStaleState ErrClass = "stale_state" ErrHookFailed ErrClass = "hook_failed" ErrConflict ErrClass = "conflict" ErrMergeInProgess ErrClass = "merge_in_progress" ErrRefusal ErrClass = "git_refusal" ErrLocked ErrClass = "index_locked" ErrTimeout ErrClass = "timeout" ErrTooLarge ErrClass = "too_large" ErrCancelled ErrClass = "cancelled" ErrOther ErrClass = "other" )
type Error ¶
type Error struct {
Class ErrClass
OpClass OpClass
Op string // git subcommand, e.g. "diff", "commit"
ExitCode int
Stderr string // truncated; UI display only, never logged by this package
Paths []string // conflicting files of a stopped merge/rebase; UI display only
// contains filtered or unexported fields
}
Error is a structured Git failure: it keeps the operation class and the raw stderr for surfacing in the UI, and a coarse class for branching.
type FileDiff ¶
FileDiff is what an on-demand read of one deferred file produced: its combined hunks, and each side's when changes sit staged and unstaged at once (otherwise the combined hunks are the side).
type GraphQuery ¶
GraphQuery bounds a graph read. Hidden holds full ref names left out of the graph: a commit only they reach disappears, a commit shared with a visible ref stays.
type Hunk ¶
type Hunk struct {
OldStart int
OldLines int
NewStart int
NewLines int
Section string // trailing @@ context
Lines []DiffLine
}
Hunk is one @@ region of a file patch.
type PushOffer ¶
type PushOffer struct {
Remote string
Branches []PushRef // the current branch first, then by name
Tags []PushRef // newest first, as ListTags orders them
}
PushOffer is what the dialog lists for one remote.
type PushRef ¶
type PushRef struct {
Kind PushKind
Name string // the local branch or tag
Dest string // the branch's name on the remote (== Name for a tag)
Ahead, Behind int // against the upstream, or the fetched same-name remote branch
New bool // the remote has no such branch (as far as the last fetch knows)
Tracked bool // the branch has an upstream on this remote
Current bool // the branch checked out here
// Blocked is why the ref cannot be pushed without force ("" when it can).
// There is no force push here; a diverged branch is pulled first.
Blocked string
}
PushRef is one ref the multi-push dialog offers: a local branch with something to send (or none of it on the remote yet), or a local tag.
type RebaseAction ¶
type RebaseAction string
RebaseAction is one line of an interactive rebase todo.
const ( RebasePick RebaseAction = "pick" RebaseReword RebaseAction = "reword" RebaseSquash RebaseAction = "squash" RebaseFixup RebaseAction = "fixup" RebaseDrop RebaseAction = "drop" )
type RebaseCommit ¶
type RebaseCommit struct {
CommitInfo
Published bool // reachable from a remote-tracking ref: rewriting it needs a force push
Message string // the full message, what a reword starts from
}
RebaseCommit is a commit the plan can rewrite.
type RebaseStep ¶
type RebaseStep struct {
Hash string
Action RebaseAction
Message string
}
RebaseStep is one planned commit: its action and, for reword, the new message.
type ReflogEntry ¶
type ReflogEntry struct {
Hash string
Selector string // HEAD@{n}
Action string // "commit: fix typo", "checkout: moving from a to b"
Subject string // the commit's own subject
Time time.Time
}
ReflogEntry is one move of HEAD.
type RemoteBranch ¶
RemoteBranch is one locally cached remote-tracking ref. Listing refs does not fetch, mutate or infer whether the remote is reachable.
type RepoFacts ¶
type RepoFacts struct {
Root string
Branch string
Head string // empty when the repository has no commits yet
Signature string
// NoHead marks an unborn branch (repository without any commit).
NoHead bool
}
RepoFacts is the identity set of one repository at one moment: root, current branch, HEAD hash, and a status signature covering the full working-tree/index state. It is the stale-state fence input (plan §22.3).
type Runner ¶
type Runner struct {
// GitBinary defaults to "git".
GitBinary string
// Now overrides the clock for tests.
Now func() time.Time
// contains filtered or unexported fields
}
Runner owns every Git subprocess this package spawns. The zero value is usable; GitBinary overrides the executable in tests.
func (*Runner) AddSubmodule ¶
AddSubmodule clones url into rel and records it (staged: .gitmodules and the gitlink). It contacts the network.
func (*Runner) AddWorktree ¶
AddWorktree checks out a new work tree at path on a branch named after the path's folder, created from HEAD.
func (*Runner) ApplyLines ¶
func (r *Runner) ApplyLines(ctx context.Context, root, path string, h Hunk, selected map[int]bool, unstage bool) error
ApplyLines stages (or unstages) the selected lines of one hunk of path's change in the index; the worktree is never touched. Tracked files only: the caller offers it for modified text files shown on one side.
func (*Runner) ApplyPatch ¶
ApplyPatch applies a patch file (a diff, or a format-patch mailbox) to the working tree only — never the index, never a commit. The patch is checked first, so a patch that does not fit changes nothing.
func (*Runner) BlobSize ¶
BlobSize returns the byte size of the blob named by spec ("<rev>:<path>", ":0:<path>" for the index) without reading it.
func (*Runner) BranchUpstream ¶
BranchUpstream reads what a local branch tracks ("" when nothing).
func (*Runner) CapturePreflight ¶
func (r *Runner) CapturePreflight(ctx context.Context, root string, snap *ChangesSnapshot, selected []string) (CommitPreflight, error)
CapturePreflight snapshots HEAD/branch/status signature plus per-file fingerprints and live object identities for the selected paths.
func (*Runner) CheckoutDetached ¶
CheckoutDetached moves HEAD to one exact commit (detached). Git itself refuses when local changes would be overwritten.
func (*Runner) CheckoutRemoteBranch ¶
CheckoutRemoteBranch checks out a remote-tracking branch: the local branch of the same name when one exists, otherwise a new one that tracks it (what Fork's "Check Out…" on a remote branch does).
func (*Runner) CherryPickCommit ¶
CherryPickCommit applies one verified full commit ID to current HEAD. Selecting a merge commit without mainline is deliberately refused.
func (*Runner) Commit ¶
func (r *Runner) Commit(ctx context.Context, root string, draft CommitDraft, pre CommitPreflight, snap *ChangesSnapshot) (CommitResult, error)
Commit executes the index-preserving selected-file transaction (plan §22.4). Holds the single-flight repository lock for the entire transaction.
func (*Runner) CommitByHash ¶
CommitByHash reads one commit's list metadata (no decorations).
func (*Runner) CommitMessage ¶
CommitMessage reads the full message (subject, blank line, body) of one commit, trailing whitespace trimmed. The hash must name a commit; a non-commit is refused before the log runs.
func (*Runner) CommitSnapshot ¶
CommitSnapshot builds the change set of one commit: its diff against the first parent (or the empty tree for a root commit). Review-only: the staged/unstaged sides and the worktree do not apply.
func (*Runner) CompareToWorktree ¶
func (r *Runner) CompareToWorktree(ctx context.Context, root, hash string) (*ChangesSnapshot, error)
CompareToWorktree is the review of one commit against the working tree (staged and unstaged changes included, untracked files not): what changed between that commit and what is on disk now.
func (*Runner) CreateBranch ¶
CreateBranch creates and checks out a new local branch (`git switch -c`). No tracking setup, no start-point customization in core 0.10. The name is validated by check-ref-format first, so it cannot start with '-' and the option-value form is injection-safe.
func (*Runner) CreateBranchAt ¶
CreateBranchAt creates and checks out a branch at one exact commit.
func (*Runner) CreateTagAnnotated ¶
CreateTagAnnotated creates a tag at hash (HEAD when empty). A message makes it an annotated tag (travels by stdin, never argv); without one it is the lightweight tag CreateTag makes.
func (*Runner) CreateTagAt ¶
CreateTagAt tags one exact commit.
func (*Runner) CurrentBranch ¶
CurrentBranch returns the checked-out branch, "" on a detached HEAD.
func (*Runner) DefaultRemote ¶
DefaultRemote returns the repository's remote to act against: the first configured remote, or "origin" when none is configured yet.
func (*Runner) DeleteBranch ¶
DeleteBranch deletes a local branch with Git's safe -d: unmerged branches are refused, never forced away.
func (*Runner) DeleteRemoteBranch ¶
DeleteRemoteBranch removes one branch from its remote (`git push <remote> :refs/heads/<name>`). The branch must be one Git lists as remote-tracking.
func (*Runner) DeleteRemoteTag ¶
DeleteRemoteTag removes one tag from a configured remote's server.
func (*Runner) DeleteUntracked ¶
DeleteUntracked removes untracked paths from the worktree directly — the sanctioned replacement for `git clean -f`, which stays banned. The UI must confirm before calling: the files are deleted, not stashed.
func (*Runner) Discard ¶
Discard throws away the worktree changes of tracked paths (`git restore --`). The UI must confirm before calling: the content is unrecoverable.
func (*Runner) Facts ¶
Facts captures root/branch/HEAD plus the status signature in as few Git calls as possible. The signature hashes `status --porcelain=v1 -z` output (index + worktree + untracked), so any index/worktree mutation changes it.
func (*Runner) FetchAll ¶
FetchAll fetches every configured remote, optionally dropping remote-tracking branches the servers no longer have.
func (*Runner) FetchedAt ¶
FetchedAt reports when the repository's remotes were last fetched: the newest modification time of FETCH_HEAD, the file every fetch rewrites, in the worktree's own git dir and in the repository's common one (a fetch run from any linked worktree updates the shared remote refs, but writes only its own FETCH_HEAD). ok is false when nothing was ever fetched — a repository with no remote included.
func (*Runner) FileHistory ¶
func (r *Runner) FileHistory(ctx context.Context, root, rel string, limit int) ([]CommitInfo, error)
FileHistory lists the commits that touched one path, following renames, newest first.
func (*Runner) FileLines ¶
func (r *Runner) FileLines(ctx context.Context, root, relPath string, start, count int) ([]string, error)
FileLines reads a bounded window of working-tree file lines for unchanged-context expansion (plan §19.4). Read-only and bounded; callers run it on background lanes only — never from a render pass. start is 1-based; count lines from there.
func (*Runner) FinishSequencer ¶
func (r *Runner) FinishSequencer(ctx context.Context, root string, expected SequencerKind, abort bool) error
FinishSequencer revalidates live state before any Git mutation. Abort is explicit and may throw away conflict-resolution edits, so the UI confirms first. Continue refuses to operate while any index entry is unresolved.
func (*Runner) FormatPatch ¶
FormatPatch is one commit as an mbox patch (`git format-patch -1 --stdout`), the text "Save as Patch" writes.
func (*Runner) GraphPosition ¶
func (r *Runner) GraphPosition(ctx context.Context, root string, q GraphQuery, hash string) (int, error)
GraphPosition is the 0-based row a commit has in the graph ListCommitGraph draws for q (without a limit), or -1 when the graph never reaches it — the size the window must grow to for the commit to be a row.
func (*Runner) InteractiveRebase ¶
func (r *Runner) InteractiveRebase(ctx context.Context, root, base string, steps []RebaseStep) error
InteractiveRebase replays base..HEAD as the steps say. The todo is handed to Git through GIT_SEQUENCE_EDITOR (a copy of a file we wrote), rewords become an `exec git commit --amend -F` line, and a rebase that stops is aborted at once like RebaseOnto: the repository is never left half-done.
func (*Runner) LastCommitMessage ¶
func (r *Runner) LastCommitMessage(ctx context.Context, root string) (subject, body string, err error)
LastCommitMessage returns the subject and body of HEAD, for the Amend prefill. It fails on an unborn branch.
func (*Runner) ListBranches ¶
ListBranches enumerates local branches cheaply (no network).
func (*Runner) ListCommitGraph ¶
func (r *Runner) ListCommitGraph(ctx context.Context, root string, q GraphQuery) ([]CommitInfo, error)
ListCommitGraph reads every branch, remote-tracking branch and tag, plus HEAD, newest first in date order (a parent never precedes its children, which the lane projection relies on). Stashes and notes stay out.
func (*Runner) ListCommits ¶
ListCommits reads the history of HEAD, newest first, bounded.
func (*Runner) ListRemoteBranches ¶
ListRemoteBranches reads refs/remotes without network activity. Symbolic HEAD pointers are excluded; only actual branch refs belong in the tree.
func (*Runner) ListRemotes ¶
ListRemotes reads the configured remotes (no network).
func (*Runner) ListSubmodules ¶
ListSubmodules reads `git submodule status` (no network, not recursive).
func (*Runner) ListTree ¶
ListTree lists the direct children of dir ("" is the repository root) in rev's tree: directories first, then by name, case-insensitively. rev is anything Git resolves to a commit or tree (a hash, a branch, a tag); a revision starting with "-" or a dir that climbs out of the tree is refused before Git is asked. A directory that did not exist at rev is an empty list, not an error.
func (*Runner) ListWorktrees ¶
ListWorktrees enumerates the repository's work trees (no network).
func (*Runner) MergeFastForward ¶
MergeFastForward updates the checked-out branch to a selected EXISTING local branch, only if the current HEAD is its ancestor. A divergent history is refused: no conflict markers, no surprise merge commits. Users can decide separately whether they want a no-ff merge in a later explicitly designed conflict-resolution workflow.
func (*Runner) MergeInProgress ¶
MergeInProgress reports an in-progress merge/revert/cherry-pick state, where Git refuses partial commits (fail-closed input for Commit).
func (*Runner) MergeNoFastForward ¶
MergeNoFastForward performs an explicitly confirmed merge. It cannot silently merge a dirty tree; conflicts may leave MERGE_HEAD for the user to resolve in the inspector or Terminal.
func (*Runner) MergeSquash ¶
MergeSquash folds every change of target into the index without committing, so the user reviews the result and commits it as one. It needs a clean working tree; if it stops on conflicts it is rolled back (`reset --merge`) because a squash leaves no MERGE_HEAD for a Continue/Abort banner to hold.
func (*Runner) Mutate ¶
Mutate runs one explicit mutation command single-flight per repo root. Callers must have already revalidated state; the runner only serializes.
func (*Runner) Pull ¶
Pull fetches branch from remote and integrates it into the current branch. Fast-forward refuses a diverged history; merge may pause on conflicts (the merge banner then offers Continue/Abort); a rebase that stops on conflicts is aborted at once and reported with the paths, like RebaseOnto.
func (*Runner) PullFFOnly ¶
PullFFOnly pulls with --ff-only: Git refuses a diverged history instead of creating surprise merges, and the UI surfaces the refusal.
func (*Runner) Push ¶
Push publishes the branch to the remote; setUpstream sets tracking the first time a branch is published.
func (*Runner) PushMany ¶
func (r *Runner) PushMany(ctx context.Context, root, remote string, refs []PushRef, setUpstream bool) error
PushMany publishes the given refs to remote in one `git push`: each branch lands on its Dest, each tag on itself. setUpstream (-u) records tracking for the pushed branches that have none. There is never a force: every refspec is fully qualified and carries no "+", a ref that is Blocked is refused, and a branch or tag that no longer exists locally is refused before Git is asked.
func (*Runner) PushTag ¶
PushTag publishes one existing tag (explicit; plain Push never sends tags).
func (*Runner) PushTo ¶
PushTo publishes local branch src as dst on the remote: a branch whose upstream has another name (or lives on a second remote) must land on that upstream, not on a same-named branch of the first remote.
func (*Runner) Read ¶
Read runs one bounded, read-only Git command in root. It never mutates worktree or index state (GIT_OPTIONAL_LOCKS=0 keeps even refreshes lockless).
func (*Runner) ReadBlob ¶
ReadBlob returns the blob named by spec when it is at most max bytes; a larger one is refused with ErrTooLarge before any of it is read.
func (*Runner) ReadFileDiff ¶
func (r *Runner) ReadFileDiff(ctx context.Context, root, base string, cf ChangeFile) (FileDiff, error)
ReadFileDiff reads the diff of one deferred file: through Git for a tracked path, against base (the DiffBase of its snapshot), and from the disk for an untracked one. The output is bounded by MaxOnDemandPatchBytes; past it the error is ErrTooLarge.
func (*Runner) ReadPushOffer ¶
ReadPushOffer lists, for remote, the local branches that have commits to send (or are not on the remote yet) and the local tags. It reads only what the last fetch recorded; no network. A branch tracking another remote is not offered here.
func (*Runner) RebaseOnto ¶
RebaseOnto replays the current branch on top of a local or remote-tracking branch. A rebase that stops on conflicts is aborted at once and reported with the conflicting paths: Solco has no rebase continue/skip workflow, so it never leaves one half-done (the user resolves it in the Terminal or merges instead).
func (*Runner) RebasePlan ¶
RebasePlan lists base..HEAD oldest first. Merge commits in the range are refused (a linear rebase would flatten them silently).
func (*Runner) RemoveRemote ¶
RemoveRemote deletes a remote and its tracking branches.
func (*Runner) RemoveSubmodule ¶
RemoveSubmodule unregisters one listed submodule and stages its removal (`submodule deinit` then `rm`); Git's own modules folder stays for a later re-add.
func (*Runner) RemoveWorktree ¶
RemoveWorktree deletes one linked work tree. The main work tree is never a target, and Git itself refuses one with changes or a lock.
func (*Runner) RenameBranch ¶
RenameBranch renames a local branch (`git branch -m`); the new name is checked by check-ref-format first.
func (*Runner) RenameRemote ¶
RenameRemote renames a remote; Git moves its tracking refs along.
func (*Runner) RequireCleanWorktree ¶
RequireCleanWorktree prevents history mutations from silently combining pending local edits with merge/revert. This checks both staged and unstaged files and untracked files; a failed status read fails closed.
func (*Runner) ResetTo ¶
func (r *Runner) ResetTo(ctx context.Context, root, hash string, mode ResetMode) (previous string, err error)
ResetTo moves the current branch to one commit. Hard additionally demands a clean working tree, so no uncommitted work can be lost; the commits it drops stay reachable through the reflog and the previous HEAD is returned so the UI can say how to get back.
func (*Runner) ResolveCommit ¶
ResolveCommit names the commit a full ref points at (an annotated tag is peeled). Anything but a refs/ name is refused.
func (*Runner) ResolveConflict ¶
ResolveConflict resolves one unmerged file: keep a side, or accept the file as the user edited it (refused while conflict markers remain).
func (*Runner) ResolveRoot ¶
ResolveRoot walks up from dir to the enclosing worktree top-level. The empty string means "not inside a repository".
func (*Runner) RestoreFile ¶
RestoreFile writes one file as it was in a commit into the working tree (unstaged, so it shows up as a change to review or discard).
func (*Runner) RevertCommit ¶
RevertCommit creates an inverse commit for an exact full Git commit ID, preserving public history. The UI must confirm the selected commit and explain that conflicts may require manual resolution in the Terminal.
func (*Runner) SequencerState ¶
SequencerState asks Git for *this worktree's* state. It fails closed if any marker lookup fails and never trusts a stale UI snapshot.
func (*Runner) SetRemoteURL ¶
SetRemoteURL repoints an existing remote's fetch (and push) address.
func (*Runner) SetUpstream ¶
SetUpstream makes a local branch track a listed remote-tracking branch ("origin/main").
func (*Runner) Snapshot ¶
Snapshot acquires the working-tree change snapshot for root: working tree + index vs HEAD, plus untracked files (plan §14). Repository without HEAD compares to the empty tree.
func (*Runner) StashApply ¶
StashApply re-applies one stash entry and keeps it (Pop applies and drops).
func (*Runner) StashClear ¶
StashClear drops every stash entry.
func (*Runner) StashPatch ¶
StashPatch is one stash entry as a plain diff patch, untracked files included (`git stash show -p --include-untracked`), for "Save as Patch".
func (*Runner) StashPush ¶
StashPush stashes the worktree and index; untracked files join with -u so "stash" puts the whole change set away, as the Changes list shows it.
func (*Runner) StashPushPaths ¶
StashPushPaths stashes only the listed files (untracked ones included).
func (*Runner) StashRename ¶
StashRename gives one stash a new message. The stash is found by its commit hash (its stash@{n} index moves whenever another stash is made), rebuilt under the new message — it lands on top of the list, as in Fork — and the old entry is dropped only once the new one exists.
func (*Runner) StashSnapshot ¶
StashSnapshot is a stash as one review: the tracked changes it holds (against the commit it was made on) plus, when it was made with -u, the untracked files Git keeps on the stash commit's third parent.
func (*Runner) Stdin ¶
Stdin runs one mutation with stdin content (commit message transport). The message travels by pipe, never by argv, avoiding argv length limits and keeping message text out of process listings.
func (*Runner) SwitchBranch ¶
SwitchBranch moves to an existing local branch via `git switch` (plan §23.2): no force, no checkout --; Git's refusal is returned, not fought.
func (*Runner) UndoLastCommit ¶
UndoLastCommit soft-resets a LOCAL unpushed non-root HEAD commit: changes remain staged. Never silently rewrite a commit referenced by a known remote-tracking ref; published history should use Revert instead.
func (*Runner) UnmergedPaths ¶
UnmergedPaths lists the files that still have unresolved conflicts.
func (*Runner) UnsetUpstream ¶
UnsetUpstream stops a local branch tracking anything.
func (*Runner) Unstage ¶
Unstage moves index changes of paths back out of the index. On an unborn branch the staged files are simply unlinked from the index (`git rm --cached`), since there is no HEAD to restore from.
func (*Runner) UpdateSubmodule ¶
UpdateSubmodule initialises (when needed) and checks out the commit the superproject records for one listed submodule. It may contact the network.
func (*Runner) ValidateBranchName ¶
ValidateBranchName checks a candidate name through Git's own ref rules (`check-ref-format --branch`), the authority for New Branch.
func (*Runner) WithAutostash ¶
func (r *Runner) WithAutostash(ctx context.Context, root string, action func() error) (AutostashResult, error)
WithAutostash stashes the local changes, runs action and reapplies them. A failing action restores the changes at once unless it left a merge/rebase half way; a reapply that conflicts leaves the stash in place (Kept).
func (*Runner) WorkingPatch ¶
WorkingPatch is everything that differs from HEAD right now — staged, unstaged and untracked (ignored files stay out) — as one diff patch. It is built in a throw-away index, so the repository's own index, working tree and refs are never touched (only unreferenced blob objects may be written, which `git gc` prunes).
type SequencerKind ¶
type SequencerKind string
SequencerKind identifies Git's active conflict-resolution transaction. Only operations explicitly supported by this package can be continued or aborted; an unknown/rebase state must not be interpreted as clean.
const ( SequencerNone SequencerKind = "" SequencerMerge SequencerKind = "merge" SequencerRevert SequencerKind = "revert" SequencerCherryPick SequencerKind = "cherry-pick" SequencerUnsupported SequencerKind = "unsupported" )
type SequencerStatus ¶
type SequencerStatus struct {
Kind SequencerKind
Unmerged int
// UnmergedPaths is a bounded, sorted subset of actual unmerged index
// entries; Unmerged remains the exact total even when the list is long.
UnmergedPaths []string
}
SequencerStatus contains no file bodies, commit messages, or credentials.
func (SequencerStatus) Active ¶
func (s SequencerStatus) Active() bool
type Stash ¶
type Stash struct {
Ref string // e.g. stash@{0}
Hash string // the stash commit itself (what a review of the stash reads)
Base string // the commit the stash was made on (its first parent); "" if unknown
Subject string
}
Stash is one entry of the stash list.
type Submodule ¶
type Submodule struct {
Path string
Commit string
State SubmoduleState
Describe string
}
Submodule is one submodule of the repository.
type SubmoduleState ¶
type SubmoduleState string
SubmoduleState is `git submodule status`'s one-character state.
const ( SubmoduleClean SubmoduleState = "clean" SubmoduleUninitialized SubmoduleState = "uninitialized" SubmoduleModified SubmoduleState = "modified" // checked out at another commit than recorded SubmoduleConflict SubmoduleState = "conflict" )
type SwitchResult ¶
type SwitchResult struct {
Branch string
// Carried notes Git's dirty-compatible carry of working changes.
Created bool
}
SwitchResult reports the outcome of a branch switch.
type TreeEntry ¶
type TreeEntry struct {
Name string // base name
Path string // slash path from the repository root
Mode string // octal mode as Git prints it ("100644", "040000", "160000", …)
// Dir marks a sub-directory; Submodule a gitlink (a commit of another
// repository, which has no file content here).
Dir, Submodule bool
// Size is the blob's byte size; -1 for directories and submodules.
Size int64
}
TreeEntry is one child of a directory as it stood at a commit.
type TreeNode ¶
type TreeNode struct {
Name string // display segment
Path string // full repo-relative path
Dir bool
File *ChangeFile // leaf only
Children []*TreeNode
}
TreeNode is one node of the changed-path tree: a directory aggregate or a changed file leaf (plan §11.1: tree projection is separate from parsing).
func BuildTree ¶
func BuildTree(files []ChangeFile, compactOneChild bool) *TreeNode
BuildTree projects changed files into a dirs-first tree. compactOneChild collapses single-child directory chains ("a/b/c.txt" under one row).
func FilterTree ¶
FilterTree recursively keeps nodes whose own text or a descendant matches the query (case-insensitive substring). Returns nil when nothing matches.
type UpstreamStatus ¶
type UpstreamStatus struct {
Remote string // the remote the branch tracks, "" when none
Branch string // the upstream branch name
Ahead int
Behind int
OK bool
}
UpstreamStatus is the tracking state of the current branch.
func (UpstreamStatus) Diverged ¶
func (u UpstreamStatus) Diverged() bool
Diverged reports history on both sides of the upstream: Git refuses a plain push and a fast-forward pull for it.
type WebRepo ¶
type WebRepo struct {
Host string // "github.com"
Base string // "https://github.com/owner/repo"
}
WebRepo is a remote read as a web repository page.
func ParseWebRepo ¶
ParseWebRepo reads a remote address (https, ssh://, git://, scp-like) as the repository's web page. Local paths and anything unparsable are refused.
type WordRange ¶
WordRange is a rune-index [Start,End) span inside one line's text.
Source Files
¶
- autostash.go
- blob.go
- branches.go
- cache.go
- changes.go
- changes_parsing.go
- changes_snapshot.go
- changes_untracked.go
- commit.go
- commit_graph.go
- commit_prompt.go
- commit_prompt_preview.go
- context.go
- explain.go
- fork_more.go
- fork_more2.go
- generated.go
- history_actions.go
- large_diff.go
- line_patch.go
- operations.go
- patch.go
- push_many.go
- repository.go
- runner.go
- sequencer.go
- stash_rename.go
- tree.go
- tree_at.go
- worddiff.go