repo

package
v30.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CherryCommit

type CherryCommit struct {
	// Hash is the SHA1 of the commit.
	Hash string

	// Found indicates if the commit was found in the upstream branch.
	Found bool
}

CherryCommit contains an entry returned by the "git cherry" command.

type WorkingTree

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

WorkingTree encapsulates a git repository.

func Get

func Get(dir string) (wt WorkingTree, err error)

Get returns a WorkingTree for the specified directory. If the directory is not the root of a git repository the directory hierarchy is walked to find the root (i.e. the directory where the .git dir resides).

func (WorkingTree) Branch

func (wt WorkingTree) Branch() (string, error)

Branch calls "git branch" to determine the current branch.

func (WorkingTree) Checkout

func (wt WorkingTree) Checkout(tree string) error

Checkout calls "git checkout" with the specified tree.

func (WorkingTree) Cherry

func (wt WorkingTree) Cherry(upstream string) ([]CherryCommit, error)

Cherry calls "git cherry" with the specified value for upstream. Returns a slice of commits yet to be applied to the specified upstream branch.

func (WorkingTree) CherryPick

func (wt WorkingTree) CherryPick(commit string) error

CherryPick calls "git cherry-pick" with the specified commit.

func (WorkingTree) Clone

func (wt WorkingTree) Clone(dest string) (result WorkingTree, err error)

Clone calls "git clone", cloning the working tree into the specified directory. The returned WorkingTree points to the clone of the repository.

func (WorkingTree) CreateTag

func (wt WorkingTree) CreateTag(name string) error

CreateTag calls "git tag <name>" to create the specified tag.

func (WorkingTree) ListTags

func (wt WorkingTree) ListTags(pattern string) ([]string, error)

ListTags calls "git tag -l <pattern>" to obtain the list of tags. If there are no tags the returned slice will have zero length. Tags are sorted in lexographic ascending order.

func (WorkingTree) Root

func (wt WorkingTree) Root() string

Root returns the root directory of the working tree.

Jump to

Keyboard shortcuts

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