Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteStatusSync     = "sync"
	RemoteStatusGone     = "deleted"
	RemoteStatusAhead    = "ahead"
	RemoteStatusBehind   = "behind"
	RemoteStatusConflict = "conflict"
	RemoteStatusDetached = "detached"
	RemoteStatusNone     = "none"
)

Variables

View Source
var (
	Default = &Options{}

	QuietOutput = &Options{QuietStderr: true}

	Mute = &Options{
		QuietStderr: true,
		QuietCmd:    true,
	}
)
View Source
var ErrNotGit = errors.New("you are not int a git repository")

Functions

func Checkout

func Checkout(name string, create bool, opts *Options) error

func Clone

func Clone(url, path string, opts *Options) error

func Config

func Config(name, value string, opts *Options) error

func EnsureCurrent

func EnsureCurrent() (string, error)

func EnsureNoUncommitted

func EnsureNoUncommitted(opts *Options) error

func EnsurePath

func EnsurePath(dir string) error

func Exec

func Exec(args []string, opts *Options) error

func Fetch

func Fetch(remote string, branch, tag bool, opts *Options) error

func GetCurrentBranch

func GetCurrentBranch(opts *Options) (string, error)

func GetMainBranch

func GetMainBranch(remote string, opts *Options) (string, error)

func ListRemoteBranches

func ListRemoteBranches(remote string, locals []*BranchDetail, opts *Options) ([]string, error)

func ListRemotes

func ListRemotes(opts *Options) ([]string, error)

func Output

func Output(args []string, opts *Options) (string, error)

func OutputItems

func OutputItems(args []string, opts *Options) ([]string, error)

func SetRemoteURL

func SetRemoteURL(remote, url string, opts *Options) error

Types

type BranchDetail

type BranchDetail struct {
	Name string

	RemoteStatus string

	Current bool

	IsRemote bool
	Remote   string

	Commit    string
	CommitMsg string
}

func ListLocalBranches

func ListLocalBranches(opts *Options) ([]*BranchDetail, error)

func ParseBranchDetail

func ParseBranchDetail(line string) (*BranchDetail, error)

type ExecError

type ExecError struct {
	Stderr string

	Err error

	Cmd string

	Opts *Options
}

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) Extra

func (e *ExecError) Extra()

type Options

type Options struct {
	QuietCmd bool

	QuietStderr bool

	Path string

	NoTrimLines bool
}

type UncommittedChangeError

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

func (*UncommittedChangeError) Error

func (e *UncommittedChangeError) Error() string

Jump to

Keyboard shortcuts

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