Documentation ¶
Index ¶
- func InRed(txt string) string
- func IsGlobSpecial(char rune) bool
- func MatchBasename(dirent Dirent, exclude *Exclude) bool
- func MatchPathname(dirent Dirent, exclude *Exclude) bool
- func NoWildcard(pattern string) bool
- func SimpleLength(pattern string) int
- type Dirent
- type Exclude
- type ExcludeFlags
- type ExcludeList
- type IsExcluded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGlobSpecial ¶
IsGlobSpecial taken from https://github.com/git/git/blob/v2.22.0/t/helper/test-ctype.c#L38
func MatchBasename ¶
MatchBasename https://github.com/git/git/blob/v2.22.0/dir.c#L935-L957
func MatchPathname ¶
MatchPathname https://github.com/git/git/blob/v2.22.0/dir.c#L959-L1016
func NoWildcard ¶
NoWildcard https://github.com/git/git/blob/v2.22.0/dir.c#L559-L562
func SimpleLength ¶
Types ¶
type Dirent ¶
type Dirent struct {
// contains filtered or unexported fields
}
Dirent stores the name and file system mode type of discovered file system entries.
type Exclude ¶
type Exclude struct { Pattern string Base string Flags ExcludeFlags SourcePos int }
func CreateExclude ¶
CreateExclude https://github.com/git/git/blob/v2.22.0/dir.c#L610-L622
func LastExcludeMatchingFromList ¶
func LastExcludeMatchingFromList(dirent Dirent, el *ExcludeList) *Exclude
LastExcludeMatchingFromList Scan the given exclude list in reverse to see whether pathname should be ignored. The first match (i.e. the last on the list), if any, determines the fate. Returns the exclude_list element which matched, or NULL for undecided.
type ExcludeFlags ¶
type ExcludeFlags uint
ExcludeFlags stores flags for a single exclude pattern
const ( // ExcFlagNodir The pattern contains a '/', not including a possible final '/' that sets ExecFlagMustbedir ExcFlagNodir ExcludeFlags = 1 << iota // 1 // ExcFlagEndswith The pattern is an "ends-with" pattern ExcFlagEndswith // 4 // ExcFlagMustbedir The pattern should only match for directories (ends with `/`) ExcFlagMustbedir // 8 // ExcFlagNegative The pattern is negated (`!` prefixed) ExcFlagNegative // 16 )
func ParseExcludePattern ¶
func ParseExcludePattern(pattern string) (string, ExcludeFlags)
ParseExcludePattern https://github.com/git/git/blob/v2.22.0/dir.c#L564-L600
func (ExcludeFlags) String ¶
func (f ExcludeFlags) String() string
type ExcludeList ¶
type ExcludeList struct {
Excludes []*Exclude
}
ExcludeList holds a list of Exclude elements It can be used in the future to hold additional metadata such as where these Exclude patterns came from (filename, cmd line flags, ...)
func CreateExcludeList ¶
func CreateExcludeList() *ExcludeList
CreateExcludeList creates an empty ExcludeList
func (*ExcludeList) AddExclude ¶
func (list *ExcludeList) AddExclude(pattern string, base string, srcpos int)
AddExclude https://github.com/git/git/blob/v2.22.0/dir.c#L602-L626
type IsExcluded ¶
type IsExcluded int
const ( Excluded IsExcluded = 1 NotExcluded IsExcluded = 0 ExclusionUndecided IsExcluded = -1 )
func IsExcludedFromList ¶
func IsExcludedFromList(dirent Dirent, el *ExcludeList) IsExcluded
IsExcludedFromList Scan the list and let the last match determine the fate. Return 1 for exclude, 0 for include and -1 for undecided. https://github.com/git/git/blob/v2.22.0/dir.c#L1071-L1085
func (IsExcluded) String ¶
func (val IsExcluded) String() string