domain

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffTrees

func DiffTrees(base, target Tree) ([]fdiff.FilePatch, error)

DiffTrees calculates diffs between two trees.

Diff implementations is referred from go-git's (*git.Worktree).Status() method.

func NewBillyFSGitignore added in v0.7.1

func NewBillyFSGitignore(fs billy.Filesystem, commitTree *object.Tree) (billy.Filesystem, error)

func ReadSystemGitignore added in v0.7.1

func ReadSystemGitignore() ([]gitignore.Pattern, error)

func SortCloneSets

func SortCloneSets(sets []*CloneSet)

Types

type Clone

type Clone struct {
	Filename string
	StartL   int
	EndL     int
	Distance float64
	// Sources indicate from which queries this co-change candidate was detected
	Sources []*Source
}

func (Clone) Key

func (c Clone) Key() string

type CloneSet

type CloneSet struct {
	Changed []*Clone
	Missing []*Clone
}

func (*CloneSet) ChangedProportion

func (cs *CloneSet) ChangedProportion() float64

func (*CloneSet) Sort

func (cs *CloneSet) Sort()

type GoGitWorktree added in v0.7.2

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

func NewGoGitWorkTree

func NewGoGitWorkTree(repo *git.Repository) (*GoGitWorktree, error)

func (*GoGitWorktree) Noder added in v0.7.2

func (g *GoGitWorktree) Noder() (noder.Noder, error)

func (*GoGitWorktree) Reader added in v0.7.2

func (g *GoGitWorktree) Reader(path string) (io.ReadCloser, error)

func (*GoGitWorktree) Status added in v0.7.2

func (g *GoGitWorktree) Status() (git.Status, error)

func (*GoGitWorktree) String added in v0.7.2

func (g *GoGitWorktree) String() string

func (*GoGitWorktree) Tree added in v0.7.2

func (g *GoGitWorktree) Tree() (t *object.Tree, err error, ok bool)

type IgnoreConfig added in v0.7.0

type IgnoreConfig struct {
	Files    []string `yaml:"files"`
	Patterns []string `yaml:"patterns"`
}

func (*IgnoreConfig) Compile added in v0.7.0

func (i *IgnoreConfig) Compile() (*IgnoreRule, error)

type IgnoreLineRule added in v0.7.0

type IgnoreLineRule struct {
	IgnoreLines map[int]struct{}
	// contains filtered or unexported fields
}

func (*IgnoreLineRule) CanSkip added in v0.7.0

func (l *IgnoreLineRule) CanSkip(startLine int, windowSize int) (canSkip bool, skipUntil int)

CanSkip determines if window size starting from startLine can be skipped.

Caller expectations:

  • Callers are expected to monotonically increase startLine.
  • Next call to CanSkip() starts from skipUntil+1, if canSkip is true.

type IgnoreRule added in v0.7.0

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

type MatcherConfigs added in v0.10.0

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

func (*MatcherConfigs) Compile added in v0.10.0

func (m *MatcherConfigs) Compile() (*MatcherRules, error)

type MatcherRules added in v0.10.0

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

func ReadMatcherRules added in v0.10.0

func ReadMatcherRules(repoDir string, disableDefault bool, ignoreCLIOptions, includeCLIOptions []string) (*MatcherRules, error)

func (*MatcherRules) Match added in v0.10.0

func (m *MatcherRules) Match(path string, contents []byte) (skipEntireFile bool, ignoreRule *IgnoreLineRule)

Match checks the file and its contents to ignore. If skipEntireFile is true, callers are expected to skip this entire file (ignoreRule is nil). Otherwise, callers are expected to call IgnoreLineRule.CanSkip() method according to its doc to check file ignore pattern.

type Searcher

type Searcher interface {
	Files() ([]string, error)
	Open(name string) (SearcherFile, error)
}

Searcher is an interface for use with clone search backend implementations.

func NewSearcherFromTree

func NewSearcherFromTree(tree Tree) Searcher

type SearcherFile

type SearcherFile interface {
	Name() string
	IsBinary() (bool, error)
	Content() ([]byte, error)
}

type Source

type Source struct {
	Filename string
	StartL   int
	EndL     int
}

func (Source) Key

func (s Source) Key() string

func (Source) SlideCut

func (s Source) SlideCut(window int) []*Source

SlideCut cuts this source into multiple sources, sliding by the specified window size.

type Tree

type Tree interface {
	// String should return a short human-readable representation of this tree.
	String() string
	// Tree MAY return concrete go-git tree implementation, for use with direct comparison from the other tree
	// and with the go-git embedded rename detection function.
	//
	// If Tree() returns false, comparison will fallback to Noder() diffing.
	Tree() (t *object.Tree, err error, ok bool)
	// Noder returns noder.Noder for diffing changes from the other noder.Noder instance.
	Noder() (noder.Noder, error)
	// Reader returns io.ReadCloser to the file contents.
	Reader(path string) (io.ReadCloser, error)
}

Tree represents a tree-like filesystem with various backends. Tree interface is used for comparison between two filesystem snapshots without depending on a specific backend implementation.

func NewGoGitCommitTree

func NewGoGitCommitTree(commit *object.Commit, ref string) Tree

func NewGoGitWorktreeWithOverlay

func NewGoGitWorktreeWithOverlay(repo *git.Repository, overlay *ds.SyncMap[string, string]) (Tree, error)

Jump to

Keyboard shortcuts

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