git

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitialCommitHash = "(initial)"
)

Variables

View Source
var (
	ErrDoesNotExist  = errors.New("path does not exist")
	ErrNotDirectory  = errors.New("not a directory")
	ErrNotRepository = errors.New("not a git repository")

	ErrDotGitOpen = errors.New("attempt to open .git/ as a repository")

	ErrRepositoryHasNoCommits = errors.New("repository has no commits")
	ErrUnknownPathspec        = errors.New("no such branch")

	ErrLocalChangesOverwritten = errors.New("commit or stash changes first")
	ErrUntrackedOverwritten    = errors.New("untracked files in the way")

	ErrBranchAlreadyExists = errors.New("branch already exists")

	ErrNoRemote = errors.New("no remote configured")

	ErrNoUpstream         = errors.New("branch tracks no remote")
	ErrNotFastForward     = errors.New("diverged, can't fast-forward")
	ErrMergeRefNotFetched = errors.New("upstream missing, fetch first")
)

Functions

This section is empty.

Types

type ConflictPathStatus

type ConflictPathStatus struct {
	StateThem PathState
	StateUs   PathState
	Path      string
}

type DiffNumStat

type DiffNumStat struct {
	Paths []PathDiffNumStat
}

type MovedPathStatus

type MovedPathStatus struct {
	StateIndex PathState
	StateFS    PathState
	Path       string
	OrigPath   string
}

type ParseError

type ParseError struct {
	Errs []error
}

func (*ParseError) Error

func (e *ParseError) Error() string

type PathDiffNumStat

type PathDiffNumStat struct {
	Path         string
	AddedLines   int
	DeletedLines int
}

type PathState

type PathState byte
const (
	UnknownPathState    PathState = iota // 0
	NotChangedPathState                  // 1
	ModifiedPathState                    // 2
	AddedPathState                       // 3
	DeletedPathState                     // 4
	RenamedPathState                     // 5
	CopiedPathState                      // 6
	UpdatedPathState                     // 7
	UntrackedPathState                   // 8
	IgnoredPathState                     // 9
)

type RegularPathStatus

type RegularPathStatus struct {
	StateIndex PathState
	StateFS    PathState
	Path       string
}

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string) (Repo, error)

func (Repo) Branches added in v0.1.0

func (r Repo) Branches(ctx context.Context) ([]string, error)

Branches lists the repo's local branch names. A repo with no commits has no branches and yields an empty slice.

func (Repo) Checkout added in v0.1.0

func (r Repo) Checkout(ctx context.Context, what string) error

func (Repo) CheckoutBranch added in v0.1.0

func (r Repo) CheckoutBranch(ctx context.Context, name string) error

func (Repo) DiffNumStatHead

func (r Repo) DiffNumStatHead(ctx context.Context) (DiffNumStat, error)

func (Repo) Fetch added in v0.1.0

func (r Repo) Fetch(ctx context.Context) error

func (Repo) Path

func (r Repo) Path() string

func (Repo) PullFastForward added in v0.1.0

func (r Repo) PullFastForward(ctx context.Context) error

func (Repo) Root added in v0.1.2

func (r Repo) Root() string

func (Repo) Status

func (r Repo) Status(ctx context.Context) (Status, error)

func (Repo) Switch

func (r Repo) Switch(ctx context.Context, branch string) error

func (Repo) SwitchCreate added in v0.2.0

func (r Repo) SwitchCreate(ctx context.Context, branch string) error

type Status

type Status struct {
	Commit   string
	Branch   string
	Upstream string
	Ahead    int
	Behind   int
	Paths    []any
}

type TokenParseError

type TokenParseError struct {
	TokenIndex int
	Token      []byte
	Err        error
}

func (TokenParseError) Error

func (e TokenParseError) Error() string

type UnknownRunError

type UnknownRunError struct {
	Res exec.Result
	Err error
}

func NewUnknownRunErr

func NewUnknownRunErr(res exec.Result, err error) *UnknownRunError

func (*UnknownRunError) Error

func (e *UnknownRunError) Error() string

type UntrackedPathStatus

type UntrackedPathStatus struct {
	Path string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL