repository

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocalBranchNotFound = errors.New("local branch not found")

Functions

func Apply added in v0.3.0

func Apply(c Commit, opts ...func(c *Commit)) error

func WithAmend added in v0.3.0

func WithAmend(b bool) func(c *Commit)

func WithDryRun added in v0.3.0

func WithDryRun(b bool) func(c *Commit)

Types

type Branch

type Branch struct {
	Local  string
	Remote string
	Refs   []string
}

type Brancher added in v0.3.0

type Brancher interface {
	Configer
	Head() (*plumbing.Reference, error)
	References() (storer.ReferenceIter, error)
}

type Commit added in v0.2.0

type Commit struct {
	Author  string
	Subject string
	Body    string
	Footer  string
	Amend   bool
	DryRun  bool
	Runner  func(w io.Writer, command string, args []string) error
}

type Configer added in v0.3.0

type Configer interface {
	Config() (*config.Config, error)
}

type Description added in v0.3.0

type Description struct {
	Users    []User
	Remotes  []string
	Head     Head
	Branch   Branch
	Worktree Worktree
}
type Head struct {
	Hash    string
	Author  User
	When    time.Time
	Message string
}
type Header interface {
	Head() (*plumbing.Reference, error)
	CommitObject(h plumbing.Hash) (*object.Commit, error)
}

type RefsOptions added in v0.3.0

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

type RefsResult added in v0.3.0

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

type Remoter added in v0.3.0

type Remoter interface {
	Remotes() ([]*git.Remote, error)
}

type Repository

type Repository struct {
	Opener       func(string, *git.PlainOpenOptions) (*git.Repository, error)
	GlobalConfig func(config.Scope) (*config.Config, error)
	Configer     Configer
	Remoter      Remoter
	Header       Header
	Brancher     Brancher
	Worktreer    Worktreer
}

func New

func New() *Repository

func (*Repository) Branch

func (r *Repository) Branch() (Branch, error)

func (*Repository) Describe added in v0.3.0

func (r *Repository) Describe() (Description, error)

func (*Repository) Head added in v0.3.0

func (r *Repository) Head() (Head, error)

func (*Repository) Open added in v0.5.0

func (r *Repository) Open() error

func (*Repository) Remotes added in v0.3.0

func (r *Repository) Remotes() ([]string, error)

func (*Repository) Users

func (r *Repository) Users() ([]User, error)

func (*Repository) Worktree added in v0.7.0

func (r *Repository) Worktree() (Worktree, error)

type User

type User struct {
	Name    string
	Email   string
	Default bool
}

type Worktree added in v0.7.0

type Worktree struct {
	Status git.Status
}

type Worktreer added in v0.7.0

type Worktreer interface {
	Worktree() (*git.Worktree, error)
}

Jump to

Keyboard shortcuts

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