Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/denormal/go-gitignore
/ functions
Functions
153 in github.com/denormal/go-gitignore
⨍
Functions
153
◇
Types & classes
28
↓ 26 callers
Method
Name
NewToken() Name returns a string representation of the Token type.
token.go:30
↓ 19 callers
Function
pos
coincident()
util_test.go:150
↓ 18 callers
Method
Position
Position returns the position in the .gitignore file at which the matching pattern was defined.
match.go:22
↓ 15 callers
Method
Local
match{}
defn_test.go:27
↓ 15 callers
Method
Match
Match returns true if the given path matches the name pattern. If the pattern is meant for directories only, and the path is not a directory, Match wi
pattern.go:18
↓ 13 callers
Function
NewError
err() NewError returns a new Error instance for the given error e and position p.
error.go:21
↓ 11 callers
Method
Underlying
Underlying returns the underlying error, permitting direct comparison against the wrapped error.
error.go:12
↓ 11 callers
Method
unread
read() unread returns the given runes to the stream, making them eligible to be read again. The runes are returned in the order given, so the last run
lexer.go:173
↓ 10 callers
Method
create
repostorytest{}
repository_test.go:24
↓ 10 callers
Method
token
pattern() token returns a Token instance of the given type_ represented by word runes.
lexer.go:434
↓ 9 callers
Method
Base
Base returns the directory containing the .gitignore file.
gitignore.go:19
↓ 9 callers
Method
String
String returns a string representation of the matched pattern.
match.go:18
↓ 9 callers
Function
dir
file()
util_test.go:38
↓ 9 callers
Method
read
String() private methods read the next rune from the stream. Return an Error if there is a problem reading from the stream. If the end of stream is
lexer.go:145
↓ 8 callers
Method
Ignore
Ignore returns true if the match pattern describes files or paths that should be ignored.
match.go:11
↓ 8 callers
Method
IsDir
Local()
defn_test.go:37
↓ 8 callers
Function
coincident
exclude()
util_test.go:143
↓ 7 callers
Method
Relative
Relative attempts to match a path relative to the GitIgnore base directory. isdir is used to indicate whether the path represents a file or a director
gitignore.go:39
↓ 7 callers
Function
directory
do()
match_test.go:348
↓ 7 callers
Method
next
eol() next returns the next token from the Lexer, or an error if there is a problem reading from the input stream.
parser.go:383
↓ 7 callers
Function
repository
TestInvalidRepositoryWithCache() helper functions
repository_test.go:303
↓ 7 callers
Function
withfile
TestNew()
gitignore_test.go:208
↓ 6 callers
Method
Token
Name() Token returns the string representation of the Token word.
token.go:35
↓ 6 callers
Method
destroy
create()
repository_test.go:73
↓ 6 callers
Function
do
TestMatchRelative()
match_test.go:299
↓ 6 callers
Function
invalid
repository()
repository_test.go:536
↓ 6 callers
Method
undo
skip() undo returns the given Token t to the parser input stream to be retrieved again on a subsequent call to next.
parser.go:418
↓ 5 callers
Method
Include
Include returns true if the match pattern describes files or paths that should be included.
match.go:15
↓ 5 callers
Method
Zero
String() Zero returns true if the Position represents the zero Position
position.go:33
↓ 5 callers
Function
buffer
pos()
util_test.go:159
↓ 5 callers
Method
err
undo() err returns an Error for the error e, capturing the current parser Position.
parser.go:428
↓ 4 callers
Method
Absolute
Absolute attempts to match an absolute path against this GitIgnore. If the path is not located under the base directory of this GitIgnore, or is not m
gitignore.go:33
↓ 4 callers
Method
Get
Get attempts to retrieve an GitIgnore instance associated with the given path. If the path is not known nil is returned.
cache.go:14
↓ 4 callers
Method
errors
err() errors returns the response from the parser error handler to the Error e. If no error handler has been configured for this parser, errors return
parser.go:435
↓ 4 callers
Function
file
(content string)
util_test.go:15
↓ 4 callers
Function
lexer
TestLexerInvalidCarriageReturn()
lexer_test.go:58
↓ 3 callers
Method
Parse
Parse returns all well-formed .gitignore Patterns contained within the parser stream. Parsing will terminate at the end of the stream, or if the parse
parser.go:13
↓ 3 callers
Method
Set
Set stores the GitIgnore ignore against its path.
cache.go:10
↓ 3 callers
Function
null
buffer()
util_test.go:164
↓ 3 callers
Method
pattern
whitespace() pattern returns all runes representing a file or path pattern, delimited either by unescaped whitespace, a path separator '/' or enf of f
lexer.go:374
↓ 3 callers
Method
peek
unread() peek returns the next rune in the stream without consuming it (i.e. it will be returned by the next call to read or peek). peek will return a
lexer.go:212
↓ 3 callers
Function
run
invalid()
repository_test.go:712
↓ 3 callers
Method
separator
sequence() separator attempts to retrieve a valid sequence of tokens that may appear after the path separator '/' Token t. An Error is returned if the
parser.go:242
↓ 2 callers
Method
Match
Base() Match attempts to match the path against this GitIgnore, and will return its Match if successful. Match will invoke the GitIgnore error handler
gitignore.go:221
↓ 2 callers
Function
NewPattern
any{} NewPattern returns a Pattern from the ordered slice of Tokens. The tokens are assumed to represent a well-formed .gitignore pattern. A Pattern m
pattern.go:55
↓ 2 callers
Function
NewWithErrors
NewFromFile() NewWithErrors creates a GitIgnore instance from the given file. If errors is given, it will be invoked for every error encountered when
gitignore.go:112
↓ 2 callers
Method
Next
Next returns the next Token from the Lexer reader. If an error is encountered, it will be returned as an Error instance, detailing the error and its p
lexer.go:27
↓ 2 callers
Method
Position
Position returns the current position of the parser in the input stream.
parser.go:24
↓ 2 callers
Method
Position
Position returns the position of the error within the .gitignore file (if any)
error.go:8
↓ 2 callers
Method
Position
Next() Position returns the current position of the Lexer.
lexer.go:128
↓ 2 callers
Method
String
String returns the string representation of the current position of the Lexer.
lexer.go:34
↓ 2 callers
Method
String
Token() String returns a string representation of the Token, encapsulating its position in the input stream, its name (i.e. type), and its runes.
token.go:41
↓ 2 callers
Method
String
String returns a string representation of the current position.
position.go:17
↓ 2 callers
Method
any
separator() any attempts to retrieve a valid sequence of tokens that may appear after the any '**' Token t. An Error is returned if the sequence if to
parser.go:289
↓ 2 callers
Method
err
token() err returns an Error encapsulating the error e and the current Lexer position.
lexer.go:459
↓ 2 callers
Function
exclude
exclude attempts to return the GitIgnore instance for the $GIT_DIR/info/exclude from the working copy to which path belongs.
exclude.go:10
↓ 2 callers
Function
invalidparse
parse()
parser_test.go:187
↓ 2 callers
Method
match
Match() match performs the recursive matching for 'any' patterns. An 'any' token '**' may match any path component, or no path component.
pattern.go:248
↓ 2 callers
Function
parse
TestParserInvalidFalse()
parser_test.go:83
↓ 2 callers
Method
pattern
any() pattern attempts to retrieve a valid sequence of tokens that may appear after the path pattern Token t. An Error is returned if the sequence if
parser.go:324
↓ 2 callers
Method
sequence
path() sequence attempts to extract a well-formed Token sequence from the Lexer representing a .gitignore Pattern. sequence returns an Error if the re
parser.go:213
↓ 2 callers
Method
skip
next() skip reads Tokens from the input until the end of line or end of file is reached. If there is a problem reading tokens, an Error is returned.
parser.go:398
↓ 1 callers
Method
Absolute
Match() Absolute attempts to match an absolute path against this repository. If the path is not located under the base directory of this repository, o
repository.go:197
↓ 1 callers
Method
Absolute
Match() Absolute attempts to match an absolute path against this GitIgnore. If the path is not located under the base directory of this GitIgnore, or
gitignore.go:244
↓ 1 callers
Method
Ignore
Ignore returns true if the path is ignored by this GitIgnore. Paths that are not matched by this GitIgnore are not ignored. Internally, Ignore uses Ma
gitignore.go:44
↓ 1 callers
Method
Include
Include returns true if the path is included by this GitIgnore. Paths that are not matched by this GitIgnore are always included. Internally, Include
gitignore.go:49
↓ 1 callers
Method
Match
Match attempts to match the path against this GitIgnore, and will return its Match if successful. Match will invoke the GitIgnore error handler (if de
gitignore.go:28
↓ 1 callers
Function
New
NewGitIgnore creates a new GitIgnore instance from the patterns listed in t, representing a .gitignore file in the base directory. If errors is given,
gitignore.go:64
↓ 1 callers
Function
NewCache
NewCache returns a Cache instance. This is a thread-safe, in-memory cache for GitIgnore instances.
cache.go:25
↓ 1 callers
Function
NewFromFile
New() NewFromFile creates a GitIgnore instance from the given file. An error will be returned if file cannot be opened or its absolute path determined
gitignore.go:80
↓ 1 callers
Function
NewLexer
NewLexer returns a Lexer instance for the io.Reader r.
lexer.go:38
↓ 1 callers
Function
NewParser
parser{} NewParser returns a new Parser instance for the given stream r. If err is not nil, it will be called for every error encountered during parsi
parser.go:38
↓ 1 callers
Function
NewRepositoryWithCache
NewRepositoryWithErrors() NewRepositoryWithCache returns a GitIgnore instance representing a git repository with a root directory base. As with NewRep
repository.go:99
↓ 1 callers
Function
NewRepositoryWithErrors
NewRepositoryWithFile() NewRepositoryWithErrors returns a GitIgnore instance representing a git repository with a root directory base. As with NewRepo
repository.go:79
↓ 1 callers
Function
NewRepositoryWithFile
NewRepository() NewRepositoryWithFile returns a GitIgnore instance representing a git repository with root directory base. The repository will use fil
repository.go:39
↓ 1 callers
Function
NewToken
NewToken returns a Token instance of the given t, represented by the word runes, at the stream position pos. If the token type is not know, the return
token.go:19
↓ 1 callers
Function
NewWithCache
NewWithErrors() NewWithCache returns a GitIgnore instance (using NewWithErrors) for the given file. If the file has been loaded before, its GitIgnore
gitignore.go:171
↓ 1 callers
Method
Next
Next returns the next well-formed .gitignore Pattern from the parser stream. If an error is encountered, and the error handler is either not defined,
parser.go:21
↓ 1 callers
Method
Next
Parse() Next returns the next well-formed .gitignore Pattern from the parser stream. If an error is encountered, and the error handler is either not d
parser.go:62
↓ 1 callers
Method
Position
Next() Position returns the current position of the parser in the input stream.
parser.go:125
↓ 1 callers
Method
Position
Position returns the current position of the Lexer.
lexer.go:30
↓ 1 callers
Method
Relative
Absolute() Relative attempts to match a path relative to the repository base directory. If the path is not matched by the repository, nil is returned.
repository.go:211
↓ 1 callers
Method
Relative
Absolute() Relative attempts to match a path relative to the GitIgnore base directory. isdir is used to indicate whether the path represents a file or
gitignore.go:260
↓ 1 callers
Method
any
Match() "any" patterns any returns a Pattern designed to match paths that include at least one any pattern '**', specifying recursive matching.
pattern.go:215
↓ 1 callers
Method
beginning
err() beginning returns true if the Lexer is at the start of a new line.
lexer.go:469
↓ 1 callers
Method
build
Position() private methods build attempts to build a well-formed .gitignore Pattern starting from the given Token t. An Error will be returned if th
parser.go:145
↓ 1 callers
Method
comment
newline() comment reads all runes until a newline or end of file is reached. An error is returned if an error is encountered reading from the stream.
lexer.go:237
↓ 1 callers
Method
compile
NewPattern() compile generates a specific Pattern (i.e. name, path or any) represented by the list of tokens.
pattern.go:102
↓ 1 callers
Method
eol
pattern() eol attempts to consume the next Lexer token to read the end of line or end of file. If a EOL or EOF is not reached , eol will return an err
parser.go:359
↓ 1 callers
Method
eol
escape() eol returns all runes from the current position to the end of the line. An error is returned if there is a problem reading from the stream, o
lexer.go:299
↓ 1 callers
Method
escape
comment() escape attempts to read an escape sequence (e.g. '\ ') form the input stream. An error will be returned if there is an error reading from th
lexer.go:270
↓ 1 callers
Method
name
name patterns - designed to match trailing file/directory names only name returns a Pattern designed to match file or directory names, with no path
pattern.go:145
↓ 1 callers
Method
negation
build() negation attempts to build a well-formed negated .gitignore Pattern starting from the negation Token t. As with build, negation returns an Err
parser.go:161
↓ 1 callers
Method
newline
peek() newline adjusts the positional counters when an end of line is reached
lexer.go:225
↓ 1 callers
Method
path
negation() path attempts to build a well-formed .gitignore Pattern representing a path specification, starting with the Token t. If the sequence of to
parser.go:186
↓ 1 callers
Method
path
Match() path patterns - designed to match complete or partial paths (not just filenames) path returns a Pattern designed to match paths that include
pattern.go:175
↓ 1 callers
Method
whitespace
eol() whitespace returns all whitespace (i.e. ' ' and '\t') runes in a sequence, or an error if there is a problem reading the next runes.
lexer.go:340
Method
Base
NewWithCache() Base returns the directory containing the .gitignore file for this GitIgnore.
gitignore.go:210
Function
ExampleNewFromFile
()
example_test.go:9
Function
ExampleNewRepository
ExampleNewFromFile()
example_test.go:33
next →
1–100 of 153, ranked by callers