gitlog

package
v0.0.0-...-7035aaa Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Overview

Package gitlog ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, repoPath string, options ...Option) (*commitIterator, error)

Exec runs the git log command against a repository on disk and returns an iterator for walking over all the commits returned.

Types

type Commit

type Commit struct {
	SHA       string
	Tree      string
	Parents   []string
	Author    Event
	Committer Event
	Message   string
	Stats     []Stat
	// contains filtered or unexported fields
}

Commit represents a commit parsed from git log

func (*Commit) String

func (c *Commit) String() string

String returns a string representation of a commit that looks like the output from the original git log command where --format=... uses the custom format template we define in buildFormatString().

type CommitOrder

type CommitOrder string
const (
	DateOrder       CommitOrder = "--date-order"
	AuthorDateOrder CommitOrder = "--author-data-order"
	TopoOrder       CommitOrder = "--topo-order"
	Reverse         CommitOrder = "--reverse"
)

type Event

type Event struct {
	Name  string
	Email string
	When  time.Time
}

Event represents the who and when of a commit event

type Option

type Option func(o *execOptions)

func WithCommitOrder

func WithCommitOrder(order CommitOrder) Option

func WithFileFilter

func WithFileFilter(fileFilter string) Option

func WithFirstParent

func WithFirstParent(firstParent bool) Option

func WithIncludeStats

func WithIncludeStats(includeStats bool) Option

func WithM

func WithM(m bool) Option

func WithMaxCount

func WithMaxCount(n int) Option

func WithNoMerges

func WithNoMerges(noMerges bool) Option

func WithStats

func WithStats(stats bool) Option

type Stat

type Stat struct {
	FilePath  string
	Additions int
	Deletions int
}

Stat holds the diff stat of a file

Jump to

Keyboard shortcuts

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