scm

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHeadUnborn is raised when there are no commits yet in the git repo
	ErrHeadUnborn = errors.New("Head commit not found")
)

Functions

func CommitIDs

func CommitIDs(limiter commitLimiter, wd ...string) ([]string, error)

CommitIDs returns commit SHA1 IDs starting from the head up to the limit

func ConfigRemove

func ConfigRemove(settings map[string]string, wd ...string) error

ConfigRemove removes git configuration settings

func ConfigSet

func ConfigSet(settings map[string]string, wd ...string) error

ConfigSet persists git configuration settings

func CreateNote

func CreateNote(noteTxt string, nameSpace string, wd ...string) error

CreateNote creates a git note associated with the head commit

func IgnoreRemove

func IgnoreRemove(ignore string, wd ...string) error

IgnoreRemove removes paths/files ignored for a git repo

func IgnoreSet

func IgnoreSet(ignore string, wd ...string) error

IgnoreSet persists paths/files to ignore for a git repo

func NewCommitLimiter

func NewCommitLimiter(
	max int, beforeStr, afterStr, author, message string,
	today, yesterday, thisWeek, lastWeek,
	thisMonth, lastMonth, thisYear, lastYear bool) (commitLimiter, error)

func RemoveHooks

func RemoveHooks(hooks map[string]string, wd ...string) error

RemoveHooks remove matching git hook commands

func RootPath

func RootPath(path ...string) (string, error)

RootPath discovers the base directory for a git repo

func SetHooks

func SetHooks(hooks map[string]string, wd ...string) error

SetHooks creates git hooks

Types

type Commit

type Commit struct {
	ID      string
	OID     *git.Oid
	Summary string
	Message string
	Author  string
	Email   string
	When    time.Time
	Files   []string
}

Commit contains commit details

func HeadCommit

func HeadCommit(wd ...string) (Commit, error)

HeadCommit returns the latest commit

type CommitNote

type CommitNote struct {
	ID      string
	OID     *git.Oid
	Summary string
	Message string
	Author  string
	Email   string
	When    time.Time
	Note    string
}

CommitNote contains a git note's details

func ReadNote

func ReadNote(commitID string, nameSpace string, wd ...string) (CommitNote, error)

ReadNote returns a commit note for the SHA1 commit id

type Status

type Status struct {
	Files []fileStatus
}

Status contains the git file statuses

func NewStatus

func NewStatus(wd ...string) (Status, error)

NewStatus create a Status struct for a git repo

func (*Status) AddFile

func (s *Status) AddFile(e git.StatusEntry)

AddFile adds a StatusEntry for each file in working and staging directories

func (*Status) HasStaged

func (s *Status) HasStaged() bool

HasStaged returns true if there are any files in staging

func (*Status) IsModified

func (s *Status) IsModified(path string, staging bool) bool

IsModified returns true if the file is modified in either working or staging

func (*Status) IsTracked

func (s *Status) IsTracked(path string) bool

IsTracked returns true if file is tracked by the git repo

Source Files

  • git.go

Jump to

Keyboard shortcuts

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