Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff interface {
	AllChanges() []codeowners.DiffFile
	ChangesSince(ref string) ([]codeowners.DiffFile, error)
	Context() DiffContext
}

func NewDiff

func NewDiff(context DiffContext, opts ...DiffOption) (Diff, error)

func NewDiffWithExecutor added in v0.1.3

func NewDiffWithExecutor(context DiffContext, executor gitCommandExecutor, opts ...DiffOption) (Diff, error)

type DiffContext

type DiffContext struct {
	Base       string
	Head       string
	Dir        string
	IgnoreDirs []string
}

type DiffOption added in v1.12.0

type DiffOption func(*GitDiff)

DiffOption configures optional GitDiff behavior.

func WithHunkFilter added in v1.12.0

func WithHunkFilter(filter HunkFilter) DiffOption

WithHunkFilter routes surviving hunks through filter before they reach an approval.

type GitDiff

type GitDiff struct {
	// contains filtered or unexported fields
}

func (*GitDiff) AllChanges

func (gd *GitDiff) AllChanges() []codeowners.DiffFile

func (*GitDiff) ChangesSince

func (gd *GitDiff) ChangesSince(ref string) ([]codeowners.DiffFile, error)

func (*GitDiff) Context

func (gd *GitDiff) Context() DiffContext

type GitRefFileReader added in v1.6.0

type GitRefFileReader struct {
	// contains filtered or unexported fields
}

GitRefFileReader reads files from a specific git ref

func NewGitRefFileReader added in v1.6.0

func NewGitRefFileReader(ref string, dir string) *GitRefFileReader

NewGitRefFileReader creates a new GitRefFileReader for reading files from a git ref

func (*GitRefFileReader) PathExists added in v1.6.0

func (r *GitRefFileReader) PathExists(path string) bool

PathExists checks if a file exists in the git ref

func (*GitRefFileReader) ReadFile added in v1.6.0

func (r *GitRefFileReader) ReadFile(path string) ([]byte, error)

ReadFile reads a file from the git ref

type HunkFilter added in v1.12.0

type HunkFilter func(ref string, files []HunkText) (map[string][]int, error)

HunkFilter reports already-reviewed hunks as indexes into each file's HeadHunks; an unrecognised file, an out-of-range index or any error leaves every hunk in place.

type HunkText added in v1.12.0

type HunkText struct {
	Name          string
	HeadHunks     []string
	ApprovalHunks []string
}

Jump to

Keyboard shortcuts

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