Documentation ¶
Index ¶
- Variables
- func CommitIDs(limiter CommitLimiter, wd ...string) ([]string, error)
- func ConfigRemove(settings map[string]string, wd ...string) error
- func ConfigSet(settings map[string]string, wd ...string) error
- func CreateNote(noteTxt, nameSpace, commitHash string, wd ...string) error
- func CurrentBranch(wd ...string) string
- func FetchRemotesAddRefSpecs(refSpecs []string, wd ...string) error
- func FetchRemotesRemoveRefSpecs(refSpecs []string, wd ...string) error
- func GitRepoPath(path ...string) (string, error)
- func IgnoreRemove(ignore string, wd ...string) error
- func IgnoreSet(ignore string, wd ...string) error
- func RemoveHooks(hooks map[string]GitHook, p string) error
- func RemoveNote(nameSpace, commitHash string, wd ...string) error
- func RewriteNote(oldHash, newHash, nameSpace string, wd ...string) error
- func SetHooks(hooks map[string]GitHook, wd ...string) error
- func Workdir(gitRepoPath string) (string, error)
- type Commit
- type CommitLimiter
- type CommitNote
- type CommitStats
- type GitHook
- type Status
Constants ¶
This section is empty.
Variables ¶
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 ¶
ConfigRemove removes git configuration settings
func CreateNote ¶
CreateNote creates a git note associated with the head commit
func CurrentBranch ¶ added in v1.0.0
CurrentBranch return current git branch name
func FetchRemotesAddRefSpecs ¶
func GitRepoPath ¶
GitRepoPath discovers .git directory for a repo
func IgnoreRemove ¶
IgnoreRemove removes paths/files ignored for a git repo
func RemoveHooks ¶
RemoveHooks remove matching git hook commands
func RemoveNote ¶ added in v1.0.1
func RewriteNote ¶ added in v1.0.1
Types ¶
type Commit ¶
type Commit struct { ID string OID *git.Oid Summary string Message string Author string Email string When time.Time Files []string Stats CommitStats }
Commit contains commit details
func HeadCommit ¶
HeadCommit returns the latest commit
type CommitLimiter ¶
type CommitLimiter struct { Max int DateRange util.DateRange Before time.Time After time.Time Author string Message string Subdir string HasMax bool HasBefore bool HasAfter bool HasAuthor bool HasMessage bool HasSubdir bool }
CommitLimiter struct filter commits by criteria
func NewCommitLimiter ¶
func NewCommitLimiter( max int, fromDateStr, toDateStr, author, message string, today, yesterday, thisWeek, lastWeek, thisMonth, lastMonth, thisYear, lastYear bool) (CommitLimiter, error)
NewCommitLimiter returns a new initialize CommitLimiter struct
type CommitNote ¶
type CommitNote struct { ID string OID *git.Oid Summary string Message string Author string Email string When time.Time Note string Stats CommitStats }
CommitNote contains a git note's details
type CommitStats ¶
CommitStats contains the files changed and their stats
func DiffParentCommit ¶
func DiffParentCommit(childCommit *git.Commit) (CommitStats, error)
DiffParentCommit compares commit to it's parent and returns their stats
func (CommitStats) ChangeRatePerHour ¶
func (c CommitStats) ChangeRatePerHour(seconds int) float64
ChangeRatePerHour calculates the rate change per hour
type GitHook ¶
GitHook is the Command with options to be added/removed from a git hook Exe is the executable file name for Linux/MacOS RE is the regex to match on for the command
type Status ¶
type Status struct {
Files []fileStatus
}
Status contains the git file statuses
func (*Status) AddFile ¶
func (s *Status) AddFile(e git.StatusEntry)
AddFile adds a StatusEntry for each file in working and staging directories
func (*Status) IsModified ¶
IsModified returns true if the file is modified in either working or staging