Documentation ¶
Overview ¶
Package git implements interface for gathering git history diff data.
Use constructors to initialize it (InitPR, InitLast)
Index ¶
Constants ¶
View Source
const ( // Equal item represents an equals diff. Equal operation = iota // Add item represents an insert diff. Add // Delete item represents a delete diff. Delete )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change interface { // Branches returns PR source and target branch Branches() (source, target string) // Commits returns PR commits Commits() ([]Commit, error) // FilesDiff returns PR repository files diff FilesDiff() ([]FileChange, error) }
Change is abstraction upon git using go-git library Encapsulates work with pull request history diff
func GetChange ¶
func GetChange(opts ...ChangeOption) (Change, error)
type ChangeOption ¶
type ChangeOption func(settings *getSettings)
type Chunk ¶
type Chunk struct { // Content contains the portion of the file. Type Operation // Type contains the Operation to do with this Chunk. Content string }
Chunk represents a portion of a file transformation into another.
type Commit ¶
type Commit struct { // Message is the commit message, contains arbitrary text. Message string // Author is the original author of the commit. Author Signature // Committer is the one performing the commit, might be different from Author. Committer Signature // ParentsCount is count of the parent commits of the commit. ParentsCount int }
Commit data
type FileChange ¶
type FileChange struct { // Path is file path after change // empty if file deleted Path string // PrevPath is file path before change // empty if file created // diff from Path if file renamed PrevPath string // Chunks returns a slice of ordered changes to transform "from" File into // "to" File. If the file is a binary one, Chunks will be empty. Chunks []Chunk }
FileChange represents the necessary steps to transform one file into another.
func (FileChange) Stats ¶
func (c FileChange) Stats() (s Stat)
type Operation ¶
type Operation interface {
// contains filtered or unexported methods
}
Operation defines the operation of a diff item.
type Signature ¶
type Signature struct { // Name represents a person name. It is an arbitrary string. Name string // Email is an email, but it cannot be assumed to be well-formed. Email string // When is the timestamp of the signature. When time.Time }
Signature is used to identify who and when created a commit or tag.
Click to show internal directories.
Click to hide internal directories.