git

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

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrEmptyRemoteRepository

func IsErrEmptyRemoteRepository(err error) bool

Types

type Chunk

type Chunk struct {
	Operation DiffOperation
	Content   string
}

type Commit

type Commit struct {
	Hash        string
	Message     string
	Date        time.Time
	AuthorName  string
	AuthorEmail string
	Oldest      bool
	Tree        *Tree
	// contains filtered or unexported fields
}

func (*Commit) CanDiff

func (c *Commit) CanDiff() (result bool)

func (*Commit) FileChanges

func (c *Commit) FileChanges(filter *FileChangeFilter) (result []*FileChange, err error)

func (*Commit) FileContents

func (c *Commit) FileContents(path string) (result string, err error)

func (*Commit) HasParents

func (c *Commit) HasParents() (result bool, err error)

func (*Commit) IsMergeCommit

func (c *Commit) IsMergeCommit() (result bool, err error)

func (*Commit) Parents

func (c *Commit) Parents() (result []*Commit, err error)

type CommitFilter

type CommitFilter struct {
	HashFilter           manip.Filter
	EarliestTime         time.Time
	LatestTime           time.Time
	LatestTimeSet        bool
	ExcludeNoDiffCommits bool
}

func NewCommitFilter

func NewCommitFilter(
	hashFilter manip.Filter,
	earliestTime time.Time,
	latestTime time.Time,
	excludeNoDiffCommits bool,
) (result *CommitFilter)

func NewEmptyCommitFilter

func NewEmptyCommitFilter() *CommitFilter

func (*CommitFilter) CanProvideExactCommitHashValues

func (cf *CommitFilter) CanProvideExactCommitHashValues() bool

func (*CommitFilter) CanProvideExactValues

func (cf *CommitFilter) CanProvideExactValues() bool

func (*CommitFilter) ExactCommitHashValues

func (cf *CommitFilter) ExactCommitHashValues() (result manip.Set)

func (*CommitFilter) ExactValues

func (cf *CommitFilter) ExactValues() (result manip.Set)

func (*CommitFilter) FilterSet

func (cf *CommitFilter) FilterSet(items manip.Set)

func (*CommitFilter) Includes

func (cf *CommitFilter) Includes(commit interface{}) (result bool)

func (*CommitFilter) IncludesAllOf

func (cf *CommitFilter) IncludesAllOf(items manip.Set) bool

func (*CommitFilter) IncludesAnyOf

func (cf *CommitFilter) IncludesAnyOf(items manip.Set) bool

func (*CommitFilter) IncludesAnything

func (cf *CommitFilter) IncludesAnything() bool

func (*CommitFilter) IsIncludedInLogResults

func (cf *CommitFilter) IsIncludedInLogResults(commit *Commit) (result, more bool)

func (*CommitFilter) OldestCommitIsIncluded

func (cf *CommitFilter) OldestCommitIsIncluded() (result bool)

type Diff

type Diff struct {
	Line *Line

	SetLineHook lineAction
	// contains filtered or unexported fields
}

func NewDiff

func NewDiff(lineStrings []string, lineMap map[int]int) (result *Diff, err error)

func (*Diff) Incr

func (d *Diff) Incr() (ok bool)

func (*Diff) IncrBy

func (d *Diff) IncrBy(by int) (ok bool)

func (*Diff) IsLastLine

func (d *Diff) IsLastLine(lineNum int) bool

func (*Diff) OnLastLine

func (d *Diff) OnLastLine() bool

func (*Diff) SetLine

func (d *Diff) SetLine(lineNum int) (ok bool)

func (*Diff) String

func (d *Diff) String() (result string)

func (*Diff) UntilContainsCollectCode

func (d *Diff) UntilContainsCollectCode(substring string, collected *[]string) (ok bool)

func (*Diff) UntilContainsCollectTrimmedCode

func (d *Diff) UntilContainsCollectTrimmedCode(substring string, collected *[]string) (ok bool)

func (*Diff) UntilMatchesIncrement

func (d *Diff) UntilMatchesIncrement(re *regexp.Regexp) (ok bool)

func (*Diff) UntilTrueCollectCode

func (d *Diff) UntilTrueCollectCode(lineMatch lineMatch, collected *[]string) (ok bool)

func (*Diff) UntilTrueCollectTrimmedCode

func (d *Diff) UntilTrueCollectTrimmedCode(lineMatch lineMatch, collected *[]string) (ok bool)

func (*Diff) UntilTrueIncrement

func (d *Diff) UntilTrueIncrement(lineMatch lineMatch) (ok bool)

func (*Diff) WhileContainsCollectCode

func (d *Diff) WhileContainsCollectCode(substring string, collected *[]string) (ok bool)

func (*Diff) WhileContainsCollectTrimmedCode

func (d *Diff) WhileContainsCollectTrimmedCode(substring string, collected *[]string) (ok bool)

func (*Diff) WhileMatchesIncrement

func (d *Diff) WhileMatchesIncrement(re *regexp.Regexp) (ok bool)

func (*Diff) WhileTrueCollectCode

func (d *Diff) WhileTrueCollectCode(lineMatch lineMatch, collected *[]string) (ok bool)

func (*Diff) WhileTrueCollectTrimmedCode

func (d *Diff) WhileTrueCollectTrimmedCode(lineMatch lineMatch, collected *[]string) (ok bool)

func (*Diff) WhileTrueDo

func (d *Diff) WhileTrueDo(lineMatch lineMatch, lineAction lineAction) (ok bool)

func (*Diff) WhileTrueIncrement

func (d *Diff) WhileTrueIncrement(lineMatch lineMatch) (ok bool)

type DiffOperation

type DiffOperation int
const (
	Equal DiffOperation = iota
	Delete
	Add
)

func NewDiffOperationFromGit

func NewDiffOperationFromGit(gdo gitdiff.Operation) DiffOperation

func (DiffOperation) Prefix

func (i DiffOperation) Prefix() string

func (DiffOperation) String

func (i DiffOperation) String() string

type FileChange

type FileChange struct {
	Commit          *Commit
	Path            string
	Chunks          []*Chunk
	IsBinaryOrEmpty bool
	// contains filtered or unexported fields
}

func NewFileChange

func NewFileChange(commit *Commit, gitFileChange *gitobject.Change) (result *FileChange, err error)

func (*FileChange) Diff

func (fcc *FileChange) Diff() (result *Diff, err error)

func (*FileChange) FileContents

func (fcc *FileChange) FileContents() (result string, err error)

func (*FileChange) FileType

func (fcc *FileChange) FileType() (result string)

func (*FileChange) HasCodeChanges

func (fcc *FileChange) HasCodeChanges() (result bool)

func (*FileChange) IsDeletion

func (fcc *FileChange) IsDeletion() bool

type FileChangeFilter

type FileChangeFilter struct {
	PathFilter                   *manip.RegexpFilter
	ExcludeFileDeletions         bool
	ExcludeBinaryOrEmpty         bool
	ExcludeOnesWithNoCodeChanges bool
}

func NewFileChangeFilter

func NewFileChangeFilter(
	pathFilter *manip.RegexpFilter,
	excludeFileDeletions bool,
	excludeBinaryOrEmpty bool,
	excludeOnesWithNoCodeChanges bool,
) (result *FileChangeFilter)

func (*FileChangeFilter) CanProvideExactValues

func (cf *FileChangeFilter) CanProvideExactValues() bool

func (*FileChangeFilter) ExactValues

func (cf *FileChangeFilter) ExactValues() manip.Set

func (*FileChangeFilter) FilterSet

func (cf *FileChangeFilter) FilterSet(fileChanges manip.Set)

func (*FileChangeFilter) Includes

func (cf *FileChangeFilter) Includes(input interface{}) (result bool)

func (*FileChangeFilter) IncludesAllOf

func (cf *FileChangeFilter) IncludesAllOf(items manip.Set) bool

func (*FileChangeFilter) IncludesAnyOf

func (cf *FileChangeFilter) IncludesAnyOf(items manip.Set) bool

func (*FileChangeFilter) IncludesAnything

func (cf *FileChangeFilter) IncludesAnything() (result bool)

type Git

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

func New

func New(log logg.Logg) *Git

func (*Git) Clone

func (g *Git) Clone(url, cloneDir string) (result *Repository, err error)

func (*Git) IsCloneValid

func (g *Git) IsCloneValid(cloneDir string) (result bool)

func (*Git) OpenRepository

func (g *Git) OpenRepository(cloneDir string) (result *Repository, err error)

func (*Git) ValidateClone

func (g *Git) ValidateClone(cloneDir string) (err error)

type Line

type Line struct {
	Num         int
	NumInFile   int
	Pre         string
	Code        string
	CodeTrimmed string
	IsEqu       bool
	IsAdd       bool
	IsDel       bool
}

func NewLine

func NewLine(lineString string, num, numInFile int) *Line

func (*Line) Contains

func (l *Line) Contains(substr string) bool

func (*Line) EndsWith

func (l *Line) EndsWith(substr string) bool

func (*Line) Matches

func (l *Line) Matches(regex *regexp.Regexp) bool

func (*Line) StartsWith

func (l *Line) StartsWith(substr string) bool

func (*Line) String

func (l *Line) String() string

func (*Line) Trim

func (l *Line) Trim() string

type Repository

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

func (*Repository) Commit

func (r *Repository) Commit(hashString string) (result *Commit, err error)

func (*Repository) EmptyTree

func (r *Repository) EmptyTree() *Tree

func (*Repository) FetchAll

func (r *Repository) FetchAll(url string) (err error)

func (*Repository) GetOldestCommit

func (r *Repository) GetOldestCommit() (result *Commit, err error)

func (*Repository) Log

func (r *Repository) Log(commitFilter *CommitFilter) (result []*Commit, err error)

func (*Repository) Spawn

func (r *Repository) Spawn() (result *Repository, err error)

type Tree

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

Jump to

Keyboard shortcuts

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