fix line
This commit is contained in:
parent
cd1f23527e
commit
ed8a6f2d81
1 changed files with 2 additions and 2 deletions
4
utils.go
4
utils.go
|
@ -43,7 +43,7 @@ type GitIgnore struct {
|
||||||
// NewGitIgnore creates a new GitIgnore parser by reading .gitignore file
|
// NewGitIgnore creates a new GitIgnore parser by reading .gitignore file
|
||||||
func NewGitIgnore() (*GitIgnore, error) {
|
func NewGitIgnore() (*GitIgnore, error) {
|
||||||
gi := &GitIgnore{}
|
gi := &GitIgnore{}
|
||||||
|
|
||||||
file, err := os.Open(".gitignore")
|
file, err := os.Open(".gitignore")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
@ -104,7 +104,7 @@ func (gi *GitIgnore) matchPattern(pattern, path string) bool {
|
||||||
// Check if pattern matches any suffix of the path
|
// Check if pattern matches any suffix of the path
|
||||||
pathParts := strings.Split(path, string(filepath.Separator))
|
pathParts := strings.Split(path, string(filepath.Separator))
|
||||||
patternParts := strings.Split(pattern, "/")
|
patternParts := strings.Split(pattern, "/")
|
||||||
|
|
||||||
if len(patternParts) <= len(pathParts) {
|
if len(patternParts) <= len(pathParts) {
|
||||||
for i := 0; i <= len(pathParts)-len(patternParts); i++ {
|
for i := 0; i <= len(pathParts)-len(patternParts); i++ {
|
||||||
match := true
|
match := true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue