git

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadPatterns

func ReadPatterns(searchPath SearchPath, inputTree *InputTreeNode, accumulator []gitignore.Pattern, lastRelation Relation) ([]gitignore.Pattern, error)

ReadPatterns reads gitignore patterns recursively traversing through the directory structure. The result is in the ascending order of priority (last higher). This function has been modified to respect gitignore patterns while it's traversing. This has a big impact for larger repositories.

Types

type InputTreeNode

type InputTreeNode struct {
	Children map[string]*InputTreeNode
}

func NewInputTree

func NewInputTree(paths []string) *InputTreeNode

func NewInputTreeNode

func NewInputTreeNode(splitPath []string) *InputTreeNode

func (*InputTreeNode) AddChild

func (t *InputTreeNode) AddChild(splitPath []string)

func (*InputTreeNode) Relation

func (t *InputTreeNode) Relation(splitPath []string) Relation

type Relation

type Relation int
const (
	None Relation = iota
	TreeNodeIsChild
	TreeNodeIsParent
)

type Repo

type Repo interface {
	IsPathIgnored(path string, isDir bool) bool
}

func NewRepo

func NewRepo(path string, inputTree *InputTreeNode) (Repo, error)

type RepoFinder

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

RepoFinder finds the git repository for a given directory.

func NewRepoFinder

func NewRepoFinder(inputPaths []string) *RepoFinder

NewRepoFinder returns a new RepoFinder instance

func (*RepoFinder) FindRepo

func (s *RepoFinder) FindRepo(path string) Repo

FindRepo takes a directory path and finds the git repository for it if one exists. It works by searching within the given directory, followed by searching in parent directories until it either reaches the top-level directory or encounters an error.

type SearchPath

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

func NewSearchPath

func NewSearchPath(prefix string, path []string) SearchPath

func (SearchPath) Abs

func (s SearchPath) Abs() string

func (SearchPath) AbsSplit

func (s SearchPath) AbsSplit() []string

func (SearchPath) Path

func (s SearchPath) Path() []string

func (SearchPath) WithAddedPath

func (s SearchPath) WithAddedPath(path string) SearchPath

Jump to

Keyboard shortcuts

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