commits

package
v0.0.0-...-5dd6bc6 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package commits defines the representations of git commit objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

Author is the author of a commit.

type Commit

type Commit struct {
	Hash       string
	Message    string
	Date       time.Time
	NumParents int
	Author     *Author
}

Commit holds data for a single git commit.

func (*Commit) Body

func (c *Commit) Body() string

Body is the commit message's body.

func (*Commit) ID

func (c *Commit) ID() string

ID is the commit's hash.

func (*Commit) ShortID

func (c *Commit) ShortID() string

ShortID returns the commit hash's short form.

func (*Commit) Subject

func (c *Commit) Subject() string

Subject is the commit message's subject line.

type Commits

type Commits func() []*Commit

Commits returns commits. @todo #4 Figure out how to disable the golint check that

forces us to write redundant comments of the form
'comment on exported type Commits should be of the form
"Commits ..." (with optional leading article)' and rewrite
all comments.

func In

func In(repository repo.Repo) Commits

In returns the commits in the repo. @todo #4 These err checks are extremely annoying. Figure out

how to handle them elegantly and reduce the cyclo complexity
of this function (currently at 4).

func MsgIn

func MsgIn(reader io.Reader) Commits

MsgIn returns a single fake commit with the message read from this reader. This fake commit will have a fake hash and its timestamp will be time.Now().

func NotAuthoredByEmails

func NotAuthoredByEmails(patterns []string, cmts Commits) Commits

NotAuthoredByEmails filters out commits with authors whose emails match any of the given patterns.

func NotAuthoredByNames

func NotAuthoredByNames(patterns []string, cmts Commits) Commits

NotAuthoredByNames filters out commits with authors whose names match any of the given patterns.

func Since

func Since(t string, cmts Commits) Commits

Since returns commits authored since time t (format: yyyy-MM-dd).

func WithMaxParents

func WithMaxParents(n int, cmts Commits) Commits

WithMaxParents returns commits that have at most n number of parents. Useful for excluding merge commits.

Jump to

Keyboard shortcuts

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