git

package
v0.66.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitMessage added in v0.17.0

func CommitMessage(cmd CommandRunner, sha string) (string, error)

func CountLines added in v0.40.1

func CountLines(body []byte) (lines []int)

func CurrentBranch

func CurrentBranch(cmd CommandRunner) (string, error)

func HeadCommit

func HeadCommit(cmd CommandRunner) (string, error)

func RunGit

func RunGit(args ...string) (content []byte, err error)

Types

type BodyDiff added in v0.40.1

type BodyDiff struct {
	Before        []byte
	After         []byte
	ModifiedLines []int
}

type CommandRunner

type CommandRunner func(args ...string) ([]byte, error)

type FileBlames

type FileBlames map[string]LineBlames

type FileChange added in v0.40.1

type FileChange struct {
	Path    PathDiff
	Body    BodyDiff
	Commits []string
	Status  FileStatus
}

func Changes added in v0.40.1

func Changes(cmd CommandRunner, baseBranch string, filter PathFilter) ([]*FileChange, error)

type FileStatus added in v0.40.1

type FileStatus rune
const (
	FileAdded       FileStatus = 'A'
	FileCopied      FileStatus = 'C'
	FileDeleted     FileStatus = 'D'
	FileRenamed     FileStatus = 'R'
	FileModified    FileStatus = 'M'
	FileTypeChanged FileStatus = 'T'
)

type LineBlame

type LineBlame struct {
	Filename string
	Commit   string
	PrevLine int
	Line     int
}

type LineBlames

type LineBlames []LineBlame

func Blame

func Blame(cmd CommandRunner, path, commit string) (lines LineBlames, err error)

type Path added in v0.40.1

type Path struct {
	Name          string
	SymlinkTarget string
	Type          PathType
}

func (Path) EffectivePath added in v0.40.1

func (p Path) EffectivePath() string

type PathDiff added in v0.40.1

type PathDiff struct {
	Before Path
	After  Path
}

type PathFilter added in v0.51.0

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

func NewPathFilter added in v0.51.0

func NewPathFilter(include, exclude, relaxed []*regexp.Regexp) PathFilter

func (PathFilter) IsPathAllowed added in v0.51.0

func (pf PathFilter) IsPathAllowed(path string) bool

func (PathFilter) IsRelaxed added in v0.51.0

func (pf PathFilter) IsRelaxed(path string) bool

type PathType added in v0.40.1

type PathType int
const (
	Missing PathType = iota
	Dir
	File
	Symlink
)

type TypeDiff added in v0.40.1

type TypeDiff struct {
	Before PathType
	After  PathType
}

Jump to

Keyboard shortcuts

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