git

package
v0.0.0-...-d195741 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BlobType = ObjectType(iota)
	TreeType
	CommitType
	TagType
)
View Source
const (
	DefaultTrimCut = "\n \t"
)

Variables

View Source
var (
	ObjectTypeByName = map[string]ObjectType{
		"blob":   BlobType,
		"tree":   TreeType,
		"commit": CommitType,
		"tag":    TagType,
	}
)

Functions

func Branch

func Branch(prj string) (branch string, err error)

Branch extract the current branch's name (HEAD)

func BranchExists

func BranchExists(prj, branch string) (exists bool, err error)

BranchExists returns true if the branch exists

func Checkout

func Checkout(prj, branch string, create bool) (err error)

Checkout checkout a branch (optionally creating it)

func Clone

func Clone(wd, rel, remote, branch string) (result string, err error)

Clone clone a repo

func ConfigAdd

func ConfigAdd(prj, key, val string) error

func ConfigGet

func ConfigGet(prj, key string) (string, error)

func Pull

func Pull(prj string, ffonly, rebase bool) (result string, err error)

Pull automate the pull with ff only option

func RemoteOrigin

func RemoteOrigin(prj string) (origin string, err error)

RemoteOrigin returns the current remote.origin.url if there is no "origin" remote, then an error is returned.

func RemoteSetOrigin

func RemoteSetOrigin(prj, remote string) (err error)

RemoteSetOrigin set the current origin remote

func RevListCountHead

func RevListCountHead(prj string) (left, right int, err error)

RevParseHead read the current commit sha1

func RevParseHead

func RevParseHead(prj string) (result string, err error)

RevParseHead read the current commit sha1

func StatusWCL

func StatusWCL(prj string) (changes int, err error)

git status --porcelain | wc -l

func Upstream

func Upstream(prj string) (result string, err error)

Types

type ObjectType

type ObjectType int

type Ref

type Ref struct {
	Type ObjectType
	Name string
}

func ForEachRef

func ForEachRef(prj string) (refs []Ref, err error)

ForEachRef reads all refs from local git.

Jump to

Keyboard shortcuts

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