git

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortMerge

func AbortMerge() error

func Add

func Add(file string, options ...string) error

func CheckStatus

func CheckStatus() error

func Checkout

func Checkout(args ...string) error

func ForEachLine added in v0.3.1

func ForEachLine(cmd *exec.Cmd, f func(string) error) error

func Output

func Output(cmd *exec.Cmd) (str string, err error)

func OutputBytes

func OutputBytes(cmd *exec.Cmd) (b []byte, err error)

func OutputLines

func OutputLines(cmd *exec.Cmd) (output []string)

func OutputString

func OutputString(cmd *exec.Cmd) string

func RemoveUntracked

func RemoveUntracked() error

func Run

func Run(cmd Runner) error

func RunCmd

func RunCmd(cmd *Cmd) (err error)

func RunExecCmd

func RunExecCmd(cmd *exec.Cmd) (err error)

func SymbolicRef

func SymbolicRef(ref string) string

Types

type Cmd

type Cmd struct {
	Name    string
	Options []string
	Args    []string
}

func AddCmd

func AddCmd(file string, options ...string) *Cmd

func CheckoutCmd

func CheckoutCmd(args ...string) *Cmd

func Command

func Command(name string, args ...string) *Cmd

func StatusCmd

func StatusCmd(file string) *Cmd

func (*Cmd) AddArg

func (c *Cmd) AddArg(arg string)

func (*Cmd) AddArgs

func (c *Cmd) AddArgs(args ...string)

func (*Cmd) AddOption

func (c *Cmd) AddOption(name string, args ...string)

func (*Cmd) AllArgs

func (c *Cmd) AllArgs() []string

func (*Cmd) Build

func (c *Cmd) Build() *exec.Cmd

func (*Cmd) ForEachLine added in v0.3.1

func (c *Cmd) ForEachLine(f func(string) error) error

func (*Cmd) Output

func (c *Cmd) Output() (string, error)

func (*Cmd) OutputBytes

func (c *Cmd) OutputBytes() ([]byte, error)

func (*Cmd) OutputLines

func (c *Cmd) OutputLines() []string

func (*Cmd) OutputString

func (c *Cmd) OutputString() string

func (*Cmd) Run

func (c *Cmd) Run() error

type CommitSha

type CommitSha struct {
	Full  string
	Short string
}

func (CommitSha) String

func (r CommitSha) String() string

type MergeCmd

type MergeCmd struct {
	Strategy        MergeStrategy
	StrategyOptions []string
	MergeRef        string
	// contains filtered or unexported fields
}

func Merge

func Merge() *MergeCmd

func (*MergeCmd) Abort

func (m *MergeCmd) Abort() error

func (*MergeCmd) AddStrategyOption

func (m *MergeCmd) AddStrategyOption(option string)

func (*MergeCmd) Build

func (m *MergeCmd) Build() *exec.Cmd

func (*MergeCmd) Commit

func (m *MergeCmd) Commit()

func (*MergeCmd) FFOnly

func (m *MergeCmd) FFOnly()

func (*MergeCmd) FindRenames added in v0.3.1

func (m *MergeCmd) FindRenames(percent int)

func (*MergeCmd) IgnoreAllSpace

func (m *MergeCmd) IgnoreAllSpace()

func (*MergeCmd) NoCommit

func (m *MergeCmd) NoCommit()

func (*MergeCmd) Run

func (m *MergeCmd) Run() error

type MergeStrategy added in v0.3.1

type MergeStrategy int
const (
	NONE MergeStrategy = iota
	THEIRS
	OURS
)

func GetStrategy added in v0.3.1

func GetStrategy(str string) MergeStrategy

func (*MergeStrategy) AddTo added in v0.3.1

func (s *MergeStrategy) AddTo(f *pflag.FlagSet) *pflag.Flag

func (MergeStrategy) MarshalJSON added in v0.3.1

func (s MergeStrategy) MarshalJSON() ([]byte, error)

Json

func (MergeStrategy) Option added in v0.3.1

func (s MergeStrategy) Option() string

func (*MergeStrategy) Set added in v0.3.1

func (s *MergeStrategy) Set(val string) error

func (MergeStrategy) String added in v0.3.1

func (s MergeStrategy) String() string

func (MergeStrategy) Type added in v0.3.1

func (s MergeStrategy) Type() string

type Ref

type Ref struct {
	Name   RefName
	Commit CommitSha
	Info   RefInfo
}

func ParseRef

func ParseRef(ref string) (r Ref, err error)

func (Ref) Checkout

func (r Ref) Checkout() error

func (Ref) Delete

func (r Ref) Delete() error

func (Ref) IsEmpty

func (r Ref) IsEmpty() bool

func (Ref) Merge

func (r Ref) Merge() *MergeCmd

func (Ref) Reset

func (r Ref) Reset() Reset

func (Ref) ShortName

func (r Ref) ShortName() string

func (Ref) ShortSha

func (r Ref) ShortSha() string

func (Ref) String

func (r Ref) String() string

func (Ref) SymbolicName

func (r Ref) SymbolicName() string

func (Ref) TreeRef added in v0.3.1

func (r Ref) TreeRef() string

func (*Ref) Update

func (r *Ref) Update() (err error)

type RefInfo

type RefInfo struct {
	Type        string
	Author      string
	AuthorEmail string
	FullName    string
	ShortName   string
	RefName     string
	Push        string
	Upstream    string
}

func GetBranchInfo

func GetBranchInfo(branch string) []RefInfo

func GetRefInfo

func GetRefInfo(ref string) []RefInfo

func (RefInfo) Json

func (r RefInfo) Json() string

func (RefInfo) String

func (r RefInfo) String() string

type RefName

type RefName struct {
	Symbolic string
	Full     string
	Short    string
	Remote   string
}

func ParseRefName

func ParseRefName(fullName string) RefName

func (RefName) Checkout

func (r RefName) Checkout() error

func (RefName) String

func (r RefName) String() string

type Reset

type Reset string

func (Reset) Hard

func (c Reset) Hard() error

func (Reset) Run

func (c Reset) Run(option string) error

func (Reset) Soft

func (c Reset) Soft() error

type RevParse

type RevParse string

func (RevParse) OutputString

func (c RevParse) OutputString(option string) string

func (RevParse) Short

func (c RevParse) Short() string

func (RevParse) Symbolic

func (c RevParse) Symbolic() string

func (RevParse) SymbolicFullName

func (c RevParse) SymbolicFullName() string

type Runner

type Runner interface {
	Run() error
}

func FuncGroup

func FuncGroup(funcs ...func() error) Runner

func Group

func Group(cmds ...Runner) Runner

func ResolveCheckoutCmd

func ResolveCheckoutCmd(file string, s MergeStrategy) Runner

func ResolveRmCmd

func ResolveRmCmd(file string) Runner

func ToRunner

func ToRunner(f func() error) Runner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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