Versions in this module Expand all Collapse all v0 v0.6.1 Jun 5, 2026 v0.6.0 Jun 4, 2026 Changes in this version + var ErrDetachedHEAD = errors.New("HEAD is not on a branch — checkout a named branch first") + var ErrDirtyWorktree = errors.New("worktree has uncommitted changes — commit or stash first") + var ErrNoUpstream = errors.New(...) + var ErrUpstreamMoved = errors.New("upstream ref changed between fetch and push — retry from fetch") + func AllChangedFiles(s git.Status) []string + func AllDirtyPaths(s git.Status) []string + func CountCommitsBetween(repo *git.Repository, fromRef, toRef string) (int, error) + func DiffStats(repo *git.Repository, fromRef, toRef string) (files, insertions, deletions int, err error) + func ExactTagAtHEAD(repo *git.Repository) (string, error) + func HasStagedChanges(s git.Status) bool + func HasUnstagedChanges(s git.Status) bool + func IsAncestor(repo *git.Repository, ancestorRef, descendantRef string) (bool, error) + func IsClean(s git.Status) bool + func IsSSHURL(url string) bool + func ListTagsSorted(repo *git.Repository) ([]string, error) + func OpenRepo(rootDir string) (*git.Repository, error) + func ParseCommitLog(repo *git.Repository, fromRef, toRef string) ([]*object.Commit, error) + func RemoteRefHash(repo *git.Repository, remoteName, refName string, auth transport.AuthMethod) (plumbing.Hash, error) + func RemoteURL(repo *git.Repository, remoteName string) (string, error) + func RepoRoot(repo *git.Repository) (string, error) + func RequireAttached(state RepoState) error + func RequireClean(state RepoState) error + func RequireState(state RepoState, action string, allowed ...StateClass) error + func RequireUpstream(state RepoState) error + func RequireValid(state RepoState) error + func ResolveAuth(remoteURL string) (transport.AuthMethod, error) + func ResolveHTTPAuth(_ string) (*githttp.BasicAuth, error) + func ResolveRef(repo *git.Repository, ref string) (string, error) + func StagedFiles(s git.Status) []string + func TagMessage(repo *git.Repository, ref string) string + func UnstagedDirtyPaths(s git.Status) []string + func WorktreeStatus(wt *git.Worktree) (git.Status, error) + type ErrHookRejected struct + ExitCode int + Hook string + func (e *ErrHookRejected) Error() string + type ErrIndexDrift struct + CommitHash plumbing.Hash + func (e *ErrIndexDrift) Error() string + type ErrInvalidTransition struct + Action string + Allowed []StateClass + From StateClass + func (e *ErrInvalidTransition) Error() string + type ErrPathTraversal struct + Path string + func (e *ErrPathTraversal) Error() string + type ErrReplayCorrupted struct + Original plumbing.Hash + Replayed plumbing.Hash + func (e *ErrReplayCorrupted) Error() string + type ErrReplayUnsafe struct + Reasons []string + func (e *ErrReplayUnsafe) Error() string + type ErrTransport struct + Err error + Msg string + func (e *ErrTransport) Error() string + func (e *ErrTransport) Unwrap() error + type RepoState struct + AheadCount int + BehindCount int + Branch string + DetachedHEAD bool + HeadHash plumbing.Hash + RemoteName string + UpstreamConfigured bool + UpstreamHash plumbing.Hash + UpstreamRef string + WorktreeClean bool + func ReadRepoState(repo *git.Repository) (RepoState, error) + func (s RepoState) Diverged() bool + type StateClass string + const StateCleanAhead + const StateCleanBehind + const StateCleanSynced + const StateDetachedHEAD + const StateDirtyWorktree + const StateDiverged + const StateNoUpstream + func Classify(s RepoState) StateClass + func (c StateClass) IsValid() bool + func (c StateClass) String() string + type StatusFileChange struct + Deleted bool + Path string + func ChangedFiles(s git.Status) []StatusFileChange + func ChangedFilesInDir(s git.Status, dir string) []StatusFileChange + func StagedChanges(s git.Status) []StatusFileChange + type SyncSession struct + func OpenSyncSession(rootDir string) (*SyncSession, error) + func (s *SyncSession) Auth() transport.AuthMethod + func (s *SyncSession) FastForward(remote string) error + func (s *SyncSession) Fetch(remote string) error + func (s *SyncSession) FetchedUpstreamHash() plumbing.Hash + func (s *SyncSession) Push(remote, refspec string, setUpstream bool) error + func (s *SyncSession) Refresh() error + func (s *SyncSession) Repo() *git.Repository + func (s *SyncSession) State() RepoState + type TransitionEvent struct + Action string + From StateClass + Note string + To StateClass