Documentation
¶
Overview ¶
Package gitx reads and manipulates git repositories for the sidebar: repository discovery, worktrees, branches, status and diffs. Everything shells out to the git binary.
Index ¶
- Constants
- Variables
- func AddWorktree(ctx context.Context, root, path, branch, base string) error
- func Ahead(ctx context.Context, root, branch, base string) int
- func ApplyPatch(ctx context.Context, dir string, patch []byte, index bool) error
- func AttemptBase(branch string) string
- func AttemptBranch(base, agent string, n int, taken func(string) bool) string
- func BaseChanges(ctx context.Context, dir, branch, base string, files []string, n int) string
- func BranchFromPrompt(project, prompt string) string
- func BranchHead(ctx context.Context, root, branch string) (string, error)
- func BranchPrefix(project string) string
- func BundleAll(ctx context.Context, root, file string) error
- func Changed(ctx context.Context, dir, base string) ([]string, error)
- func ChangedAt(ctx context.Context, dir, base, rev string) ([]string, error)
- func CheckUserCommand(args []string) error
- func CheckoutDetached(ctx context.Context, root, path, ref string) error
- func Clone(ctx context.Context, url, dir string) error
- func CommitChanges(ctx context.Context, dir, message string, files []string) (string, error)
- func CommitFileDiff(ctx context.Context, dir, from, to, path string) (string, error)
- func CommitOf(ctx context.Context, dir, rev string) string
- func CommitPatchChanges(ctx context.Context, dir, message, patch string, files []string) (string, error)
- func CommitStaged(ctx context.Context, dir, message string) (string, error)
- func ConflictFiles(ctx context.Context, dir string) []string
- func CreateBundle(ctx context.Context, dir, file, branch, have string) error
- func DefaultBase(ctx context.Context, root string) string
- func DeleteBranch(ctx context.Context, root, branch string) error
- func DeleteRef(ctx context.Context, root, ref string)
- func Deleted(ctx context.Context, dir, base string) ([]string, error)
- func Diff(ctx context.Context, dir, file, rev string) (string, error)
- func DiffSize(ctx context.Context, dir, base string) (int, error)
- func DiffSizeAt(ctx context.Context, dir, base, rev string) (int, error)
- func FetchBundle(ctx context.Context, root, file, branch, ref string) (string, error)
- func Files(ctx context.Context, dir string) ([]string, error)
- func ForceRemoveWorktree(ctx context.Context, root, path string) error
- func FreshBase(ctx context.Context, dir, branch, base string) string
- func HaveCommits(ctx context.Context, dir string, list []string) ([]string, error)
- func History(ctx context.Context, dir, rev string, n int) ([]string, error)
- func IgnoredDirs(ctx context.Context, dir string) ([]string, error)
- func IgnoredPaths(ctx context.Context, dir string) ([]string, error)
- func IgnoresDir(ctx context.Context, dir, rel string) (bool, error)
- func InProgress(ctx context.Context, dir string) string
- func InitFromBundle(ctx context.Context, bundle, dir, branch string) error
- func InitRepo(ctx context.Context, dir string) error
- func IsAncestor(ctx context.Context, dir, a, b string) bool
- func Merge(ctx context.Context, dir, branch string, squash bool, message string) (string, error)
- func MergeConflicts(ctx context.Context, root, into, branch string) ([]string, error)
- func Merged(ctx context.Context, root, branch, base string) bool
- func MetaStamp(commonDir string) string
- func Operation(ctx context.Context, dir string) (op, branch string)
- func OperationWord(op string) string
- func OtherFiles(ctx context.Context, dir string) ([]string, error)
- func Printable(s string) string
- func PrintableText(s string) string
- func PruneWorktrees(ctx context.Context, root string) error
- func Push(ctx context.Context, root, branch string) error
- func PushOver(ctx context.Context, dir, branch, expect string) error
- func PushRebase(ctx context.Context, dir, branch string) (took int, err error)
- func PushedHead(ctx context.Context, dir, branch string) string
- func RebaseOnto(ctx context.Context, dir, branch, onto string) (moved bool, err error)
- func RebasingBranch(ctx context.Context, dir string) string
- func RemoteURL(ctx context.Context, root string) string
- func Remotes(ctx context.Context, dir string) []string
- func RemoveWorktree(ctx context.Context, root, path string) error
- func RepoName(rawURL string) string
- func RewriteDiff(ctx context.Context, dir string, r *Rebase, max int) (string, error)
- func RunUser(ctx context.Context, dir string, args []string, limit int) (out string, code int, truncated bool, err error)
- func SetBranch(ctx context.Context, root, branch, commit string) error
- func Slug(s string) string
- func StageChanges(ctx context.Context, dir string, files []string, patch string) error
- func TouchedFiles(ctx context.Context, dir, base string) ([]string, error)
- func UndoRebase(ctx context.Context, dir, branch, before, after string) error
- func Unmerged(ctx context.Context, root, branch, base string) (int, error)
- func Unreachable(ctx context.Context, dir string) (int, error)
- func UnstageChanges(ctx context.Context, dir string, files []string, patch string) error
- func UntrackedFiles(ctx context.Context, dir string, patterns []string, ignored bool) ([]string, error)
- func ValidBranchName(ctx context.Context, root, name string) error
- func WorkPatches(ctx context.Context, dir string) (staged, unstaged []byte, err error)
- func WorktreeDir(root, branch string) string
- type Branch
- type Changes
- type Commit
- type CommitDetail
- type Compare
- type ConflictError
- type FileChange
- type FileStat
- type LogCommit
- type OntoConflictError
- type PushRejectedError
- type Rebase
- type RebaseConflictError
- type Repo
- type RepoFormat
- type Rewrite
- type Status
- type Worktree
Constants ¶
const ( RewriteSame = "same" // the same change on a new parent RewriteChanged = "changed" // its change is different: a conflict was resolved in it RewriteDropped = "dropped" // gone: the base had it already, or it was left out RewriteAdded = "added" // new in the rewrite )
How a commit came through a rebase.
Variables ¶
var ErrEmptyBundle = errors.New("gitx: nothing to bundle")
ErrEmptyBundle means the other repository already has every commit.
var ErrNoBranch = errors.New("no such branch")
ErrNoBranch is Unmerged's answer for a branch that is not there: nothing to lose, and nothing to delete either.
var ErrNoCommits = errors.New("the repository has no commits yet")
ErrNoCommits is a repository with no commits: there is nothing for a bundle to carry.
var ErrNoMergeTree = errors.New("this git cannot try a merge without making it (git 2.38 or later can)")
ErrNoMergeTree says git is too old to try a merge without making it (merge-tree --write-tree arrived in git 2.38).
var ErrNotRepo = errors.New("gitx: not a git repository")
ErrNotRepo is returned by Discover when a directory is not inside a git work tree.
var ErrNothingToCommit = errors.New("nothing to commit")
ErrNothingToCommit is returned by CommitChanges when there are no changes.
var ErrPatchStale = errors.New("the files changed since the diff was read")
ErrPatchStale is returned when a patch no longer applies: the file changed after the diff it was cut from was read.
Functions ¶
func AddWorktree ¶
AddWorktree checks out branch at path, creating the branch from base when it does not exist locally.
func ApplyPatch ¶ added in v0.1.4
ApplyPatch applies a patch from WorkPatches in the checkout at dir, to the index as well with index. An empty patch does nothing.
func AttemptBase ¶ added in v0.1.1
AttemptBase is the task a branch is an attempt at, or "" when it is not one: the part before the last component of AttemptBranch.
func AttemptBranch ¶ added in v0.1.1
AttemptBranch names one attempt at the same task: the base branch, then the agent that tries it, so several attempts sort together under the base and read plainly in the tree:
conch/fix-flaky-test/claude conch/fix-flaky-test/codex conch/fix-flaky-test/claude-2 (the same agent, twice)
n counts from 1; taken says which names are already in use.
func BaseChanges ¶ added in v0.1.9
BaseChanges is what base did to files since branch left it, newest first and at most n commits: the other side of a conflict, for whoever resolves it.
func BranchFromPrompt ¶
BranchFromPrompt derives a branch name from an agent prompt, under the project's own name, e.g. in a project called OneNutri "Fix the flaky login tests!" -> "onenutri/fix-flaky-login-tests". Branches conch makes are grouped that way in every project; without a project name they fall back to "conch/".
func BranchHead ¶ added in v0.1.1
BranchHead returns the commit a local branch points at.
func BranchPrefix ¶ added in v0.1.3
BranchPrefix is what conch puts task branches under in a project: its name, slugged, ending in "/".
func BundleAll ¶ added in v0.2.0
BundleAll writes every branch and tag of the repository at root to file, for a machine that cannot clone it from anywhere.
func Changed ¶ added in v0.1.9
Changed lists the files the checkout's HEAD has changed since it left base, sorted.
func CheckUserCommand ¶ added in v0.1.6
CheckUserCommand refuses what the git panel must not run. A command starts with a subcommand: git's own options before it (-C, -c, --git-dir, --exec-path) would point it at another repository or at another program.
func CheckoutDetached ¶ added in v0.2.1
CheckoutDetached puts a worktree of root at path on ref, detached — no branch, so nothing finished there looks like work to ship — making it the first time and moving it after. Anything changed in it is thrown away: it is a place to read the code at ref, nothing more.
func Clone ¶ added in v0.1.4
Clone clones url into dir, which must not exist yet or be empty. It never waits for a password: a server has no one to type it.
func CommitChanges ¶ added in v0.1.1
CommitChanges commits the changes in the checkout at dir with message and returns the new commit's hash. With files empty every change is committed, untracked files included; otherwise only those paths are (a rename needs both its old and new path), and anything else already staged stays staged.
func CommitFileDiff ¶ added in v0.1.9
CommitFileDiff is one file's diff in a commit, or between two commits when from is given.
func CommitOf ¶ added in v0.1.9
CommitOf is the commit rev names in dir now, or "" when it names none: a ref read once, so what it meant then is kept when the ref moves on.
func CommitPatchChanges ¶ added in v0.1.1
func CommitPatchChanges(ctx context.Context, dir, message, patch string, files []string) (string, error)
CommitPatchChanges stages patch (a unified diff, as from Diff) and every path in files, then commits what is staged — anything staged beforehand included, as git itself would. A patch that no longer applies changes nothing and returns ErrPatchStale.
func CommitStaged ¶ added in v0.1.9
CommitStaged commits what is in the index and nothing else, as git commit does; ErrNothingToCommit when nothing is staged.
func ConflictFiles ¶ added in v0.2.1
ConflictFiles are the files a merge or rebase stopped on in the checkout at dir: those git lists as unmerged.
func CreateBundle ¶ added in v0.1.4
CreateBundle writes the commits of branch that have doesn't reach to a bundle at file. With have "" the whole history goes.
func DefaultBase ¶
DefaultBase guesses the branch new work should start from.
func DeleteBranch ¶ added in v0.1.1
DeleteBranch deletes a local branch, merged or not.
func Deleted ¶ added in v0.1.9
Deleted lists the files the checkout's HEAD has deleted since it left base, sorted: what a rewrite of the branch must not add to.
func Diff ¶
Diff returns a unified diff of file in dir. With rev empty it shows the working tree and index against HEAD (untracked files diff against /dev/null); otherwise it is `git diff <rev> -- file`, e.g. "main...feat".
func DiffSize ¶ added in v0.1.9
DiffSize is how many lines the checkout's HEAD adds and removes since it left base, together: the size of the pull request it would make.
func DiffSizeAt ¶ added in v0.1.9
DiffSizeAt is DiffSize for rev rather than the checkout's HEAD.
func FetchBundle ¶ added in v0.1.4
FetchBundle takes branch's commits from a bundle into the repository at root under ref, which it may overwrite, and returns the commit.
func Files ¶ added in v0.1.9
Files is every file of the checkout at dir that git knows or would add: tracked ones and untracked ones it does not ignore, relative to dir, with slashes. A file deleted but not yet committed is left out.
func ForceRemoveWorktree ¶ added in v0.1.1
ForceRemoveWorktree removes the linked worktree at path, discarding its uncommitted changes.
func FreshBase ¶ added in v0.1.9
FreshBase fetches base from the remote the branch would push to and names it as the remote has it ("origin/main"). Without a remote, or one that has no such branch, it is base as this checkout has it.
func HaveCommits ¶ added in v0.1.4
HaveCommits returns the commits of list that exist in the repository at dir, in list's order. Anything that isn't a full hash is left out.
func History ¶ added in v0.1.4
History lists up to n commits of rev's first-parent line, newest first: the candidates another repository may already have.
func IgnoredDirs ¶ added in v0.1.3
IgnoredDirs lists the directories in the checkout at dir that git ignores whole, relative to dir and slash-separated with no trailing slash. It is what a file watcher must not descend into: one entry stands for the whole of node_modules or target, so the answer stays small however large they are.
Ignored files are left out — only directories, which are the ones that cost a watch each.
func IgnoredPaths ¶ added in v0.1.4
IgnoredPaths lists what git ignores in the checkout at dir, relative to dir and slash-separated: files as they are, and a wholly ignored directory once, with a trailing slash, rather than everything in it.
func IgnoresDir ¶ added in v0.2.0
IgnoresDir reports whether git ignores the directory rel (relative to the checkout at dir, slash-separated) — as a directory, so a rule like `build/` counts, and whether or not anything is in it yet. IgnoredDirs cannot say this about a folder just made: an empty one is left out of its list.
func InProgress ¶ added in v0.1.6
InProgress names the operation left unfinished in the checkout at dir — "rebase", "merge", "cherry-pick", "revert" or "am" — or "" when there is none. Each worktree has its own, so a conflict in one doesn't show in the others.
func InitFromBundle ¶ added in v0.2.0
InitFromBundle makes dir, which must not exist yet or be empty, a new repository holding every branch and tag of bundle, with branch checked out — or, when it has no such branch, its first. It has no remote: a bundle is not somewhere to fetch from again.
func InitRepo ¶
InitRepo makes dir a git repository on branch main with an empty first commit, so branches and worktrees can be made from it straight away. Files already in dir are left untracked: committing them is the person's call, and a first commit made behind their back could take in a secret. The commit is made with commit-tree, like seedUnborn's, so nothing staged in a repository that already existed is swept into it, and a repository that has commits is left as it was.
Without an author identity there can be no commit, and a repository with none is one no worktree can branch from, so that is an error that says how to fix it, and a .git this call made is taken away again: the folder is left as it was found, and asking again once git has an identity works.
func IsAncestor ¶ added in v0.1.4
IsAncestor reports whether a is an ancestor of (or the same as) b.
func Merge ¶ added in v0.1.1
Merge merges branch into the branch checked out at dir, which must have no uncommitted changes to tracked files. With squash the branch's changes become one new commit; otherwise a merge commit is always made. message "" uses git's own. A merge that conflicts is undone and returned as a *ConflictError, so the checkout is left as it was.
func MergeConflicts ¶ added in v0.1.9
MergeConflicts tries merging branch into into without touching any checkout, and lists the files that would conflict; none means it would merge cleanly.
func Merged ¶ added in v0.1.1
Merged reports whether base, or base's upstream, already has everything on branch: its commits, or their changes (a squash merge).
func MetaStamp ¶
MetaStamp is a cheap fingerprint of a repository's git metadata, computed from file mtimes and sizes without running git. It changes when refs, HEAD, the index or worktrees change, so callers can skip refreshes otherwise. It reads both ref backends: the files one (refs/heads, packed-refs) and reftable, git 3's default, where every ref — HEAD too — is in reftable/ and the files above never move.
func Operation ¶ added in v0.2.1
Operation is InProgress and, for a rebase, the branch it is rewriting, read with one call to git. The branch is "" for anything but a rebase of a branch: an am also keeps rebase-apply, and a rebase of a detached HEAD writes "detached HEAD" where a branch's name would be.
func OperationWord ¶ added in v0.2.1
OperationWord says what Operation found as a person reads it beside a branch: "rebasing" for "rebase".
func OtherFiles ¶ added in v0.1.4
OtherFiles lists the files in the checkout at dir that git doesn't track and doesn't ignore.
func Printable ¶ added in v0.2.0
Printable makes text git keeps as it was written — a subject, an author, a branch name — safe to draw on a terminal. git keeps control characters, so a cloned repository's commit could carry an escape (OSC 52 writes the clipboard, OSC 2 retitles the window) that opening its history would obey. C0 controls, DEL and the C1 range (0x80–0x9f, which a terminal may take as the start of a sequence) become a dot, a tab a space, and bytes that are not UTF-8 (a raw 0x9b, say) U+FFFD.
func PrintableText ¶ added in v0.2.0
PrintableText is Printable for a commit's body: its line breaks stay.
func PruneWorktrees ¶ added in v0.1.1
PruneWorktrees forgets worktrees whose folders are gone.
func Push ¶ added in v0.1.1
Push pushes branch to the branch of the same name on its upstream's remote, or on origin (or the only remote), and makes that its upstream. An upstream under another name is not pushed to: a task branch started from origin/main tracks origin/main, and pushing there would put the task's commits on main (git's push.default=simple refuses it too). A push the remote is ahead of comes back as a *PushRejectedError, which PushRebase can mend.
func PushOver ¶ added in v0.1.9
PushOver replaces branch on its remote with the checkout's, but only if the remote still has expect there: anything pushed since is kept, and comes back as a *PushRejectedError rather than being overwritten.
func PushRebase ¶ added in v0.1.5
PushRebase takes the commits the remote has on branch, puts the branch's own on top of them and pushes. dir is the worktree the branch is checked out in, since a rebase needs one. It reports how many commits came from the remote. A rebase that conflicts is undone — the branch stays as it was and nothing is pushed — and uncommitted changes to tracked files stop it before it starts, so a rebase never moves work nobody committed.
func PushedHead ¶ added in v0.1.9
PushedHead is the commit the remote last had for branch, as this checkout knows it, or "" when it was never pushed.
func RebaseOnto ¶ added in v0.1.9
RebaseOnto puts branch's own commits on top of onto, in dir where it is checked out, and says whether that moved it. Uncommitted changes to tracked files stop it before it starts; one that conflicts is undone and comes back as an *OntoConflictError naming the files.
func RebasingBranch ¶ added in v0.1.6
RebasingBranch is the branch a rebase in the checkout at dir is rewriting, or "". git detaches HEAD while it works, so the worktree list shows no branch there until the rebase ends.
func RemoteURL ¶ added in v0.1.4
RemoteURL is the URL of the repository's origin, or of its only remote; "" when it has neither.
func Remotes ¶ added in v0.1.9
Remotes are the names of a repository's remotes (origin, upstream, a fork's), by which a decoration such as fork/main is told to be a remote's branch rather than a local one with a slash in its name.
func RemoveWorktree ¶
RemoveWorktree removes the linked worktree at path. It never forces, so a dirty worktree is refused with git's error.
func RepoName ¶ added in v0.2.0
RepoName is the folder a clone of rawURL is given by default — what `git clone` itself names it: the last part of the repository's path, without .git. It reads https and ssh URLs, scp-like ones (git@github.com:owner/repo.git) and local paths, and is "" when the URL names no repository (a host alone, or nothing).
func RewriteDiff ¶ added in v0.2.1
RewriteDiff is git range-diff's account of the rebase: for each commit that changed, the diff of its diff — what resolving the conflict did. Longer than max (when max > 0) and it is cut there.
func RunUser ¶ added in v0.1.6
func RunUser(ctx context.Context, dir string, args []string, limit int) (out string, code int, truncated bool, err error)
RunUser runs git args in dir as a person would and returns what it printed, stdout and stderr together, up to limit bytes (the rest is dropped and truncated set). A command that fails is not an error: its exit code says so. err is for a git that could not run at all, or ctx ending first.
func Slug ¶
Slug makes s safe for a directory or branch component: lowercase, with runs of other characters (including "/") collapsed to "-".
func StageChanges ¶ added in v0.1.9
StageChanges is git add: the hunks in patch and every path in files put in the index, ready for a commit of what is staged. A patch that no longer applies stages nothing (ErrPatchStale), files included.
func TouchedFiles ¶ added in v0.1.9
TouchedFiles lists what a checkout has changed since it left base: what it committed and what it has not, untracked files included — the files another branch's agent could collide with. Paths are relative to the checkout and sorted.
func UndoRebase ¶ added in v0.2.1
UndoRebase puts branch back at before, in dir where it is checked out, if it is still at after and has nothing uncommitted: the rewrite stays in the reflog, so this too can be undone.
func Unmerged ¶ added in v0.1.1
Unmerged counts the commits on branch that are in none of base, base's upstream and branch's upstream, i.e. what deleting the branch would lose. A branch whose changes base (or its upstream) already has, say because it was squash-merged, counts 0.
A count it could not make is an error, never 0: callers delete a branch that loses nothing, and a git that failed or a context that ran out says nothing about what would be lost. A branch that is not there is ErrNoBranch.
func Unreachable ¶ added in v0.1.1
Unreachable counts the commits of a detached checkout at dir that no branch or remote-tracking branch has: what removing it would lose.
func UnstageChanges ¶ added in v0.1.9
UnstageChanges takes paths, or the hunks in patch (as staged: a diff of the index against HEAD), back out of the index, leaving the files on disk as they are. In a repository with no commits yet there is no HEAD to go back to, so the paths are simply dropped from the index.
func UntrackedFiles ¶
func UntrackedFiles(ctx context.Context, dir string, patterns []string, ignored bool) ([]string, error)
UntrackedFiles lists files in the checkout at dir that git does not track and that match any of patterns, git glob pathspecs relative to dir such as ".env" or "config/*.local.json". With ignored it lists the files git ignores, otherwise the untracked files it doesn't.
func ValidBranchName ¶
ValidBranchName reports whether name is acceptable as a new branch name.
func WorkPatches ¶ added in v0.1.4
WorkPatches are the uncommitted changes in the checkout at dir as binary patches: what is staged, and what is changed on top of that.
func WorktreeDir ¶
WorktreeDir is where a worktree for branch lives: a sibling directory of the repository named <repo>.worktrees.
Types ¶
type Branch ¶
type Branch struct {
Name string
Upstream string // e.g. "origin/feat", "" if none
Gone bool // upstream configured but deleted
Ahead int // vs upstream
Behind int
BaseAhead int // commits on branch not in base
BaseBehind int // commits on base not in branch
Committed time.Time
Subject string
}
Branch is a local branch with its tracking and base divergence.
type Changes ¶
type Changes struct {
Base string
Files []FileChange // sorted by path
Commits []Commit // newest first, capped at maxCommits
}
Changes is what a worktree or branch has changed relative to a base.
func BranchChanges ¶
BranchChanges lists the files branch changed since it forked from base and the commits it has that base lacks. It works on branches that are not checked out anywhere.
type CommitDetail ¶ added in v0.1.9
type CommitDetail struct {
Hash string
Parents []string
Author string
Email string
Time time.Time
Subject string
Body string
// Files are what it changed against its first parent (the root commit:
// against nothing).
Files []FileStat
}
CommitDetail is a commit, its message whole, and the files it changed.
func ShowCommit ¶ added in v0.1.9
func ShowCommit(ctx context.Context, dir, rev string) (CommitDetail, error)
ShowCommit reads a commit and the files it changed.
type Compare ¶ added in v0.1.9
Compare is what changed from one commit to another, and how many commits that took.
type ConflictError ¶ added in v0.1.1
ConflictError is a merge that stopped on conflicts and was undone.
func (*ConflictError) Error ¶ added in v0.1.1
func (e *ConflictError) Error() string
type FileChange ¶
type FileChange struct {
Path string
OrigPath string // for renames
Code string // one of "M","A","D","R","C","T","U" (conflict),"?" (untracked)
Staged bool
Unstaged bool
Added int
Deleted int
Binary bool
}
FileChange is one changed file.
func StatusFiles ¶ added in v0.1.1
func StatusFiles(ctx context.Context, dir string) ([]FileChange, error)
StatusFiles lists the uncommitted changes in the checkout at dir, untracked files included.
type FileStat ¶ added in v0.1.9
type FileStat struct {
Path string
OrigPath string // a rename's old name
Code string // A M D R C T
Added int
Deleted int
Binary bool
}
FileStat is one file a commit or a range changed.
type LogCommit ¶ added in v0.1.9
type LogCommit struct {
Hash string
Parents []string
Author string
Time time.Time
Subject string
// Refs as git decorates them: "HEAD -> main", "origin/main",
// "tag: v1.0".
Refs []string
}
LogCommit is one commit of a repository's history, with what a graph needs to draw it: its parents, and the refs that point at it.
func Log ¶ added in v0.1.9
Log is the history reachable from every local branch and tag and from HEAD, newest first in topological order, so a commit always comes before its parents. It reads at most limit commits; more says there were others. A repository with no commits yet has no history, not an error.
type OntoConflictError ¶ added in v0.1.9
OntoConflictError is a rebase onto the base that stopped on conflicts and was undone: the branch is as it was.
func (*OntoConflictError) Error ¶ added in v0.1.9
func (e *OntoConflictError) Error() string
type PushRejectedError ¶ added in v0.1.5
type PushRejectedError struct {
Branch, Remote string
}
PushRejectedError is a push the remote refused because it holds commits the checkout does not have: somebody else pushed, or the same branch was pushed from another machine. The branch has to take them first.
func (*PushRejectedError) Error ¶ added in v0.1.5
func (e *PushRejectedError) Error() string
type Rebase ¶ added in v0.2.1
Rebase is a branch's newest rebase: its tip before and after, and the commit it was put on.
type RebaseConflictError ¶ added in v0.1.5
RebaseConflictError is a rebase that stopped on conflicts and was undone: the branch is as it was and nothing was pushed.
func (*RebaseConflictError) Error ¶ added in v0.1.5
func (e *RebaseConflictError) Error() string
type Repo ¶
type Repo struct {
Root string // main worktree top level (for a linked worktree dir, still the MAIN repo root)
CommonDir string // absolute path of the shared .git dir
}
Repo identifies a repository by its main worktree.
type RepoFormat ¶ added in v0.2.1
RepoFormat is how a repository stores itself: its object hash (sha1, or sha256 as git 3 makes new repositories) and its refs backend (files, or reftable). Both are "" outside a repository.
type Rewrite ¶ added in v0.2.1
Rewrite is one commit before and after the rebase, by short hash.
type Status ¶
type Status struct {
Staged, Unstaged, Untracked, Conflicts int // file counts
Files int // distinct changed files incl. untracked
Added, Deleted int // lines vs HEAD (tracked files; binary files count 0)
}
Status summarises uncommitted changes in a worktree.
func WorktreeStatus ¶
WorktreeStatus counts the uncommitted changes in the worktree at path.