Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

plumbing/format: gitignore, fixed an edge case for .gitignore #924

Merged
merged 1 commit into from Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions plumbing/format/gitignore/pattern.go
Expand Up @@ -133,6 +133,9 @@ func (p *pattern) globMatch(path []string, isDir bool) bool {
} else if match {
matched = true
break
} else if len(path) == 0 {
// if nothing left then fail
matched = false
}
}
} else {
Expand Down
6 changes: 6 additions & 0 deletions plumbing/format/gitignore/pattern_test.go
Expand Up @@ -281,3 +281,9 @@ func (s *PatternSuite) TestGlobMatch_wrongPattern_onTraversal_mismatch(c *C) {
r := p.Match([]string{"value", "head", "vol["}, false)
c.Assert(r, Equals, NoMatch)
}

func (s *PatternSuite) TestGlobMatch_issue_923(c *C) {
p := ParsePattern("**/android/**/GeneratedPluginRegistrant.java", nil)
r := p.Match([]string{"packages", "flutter_tools", "lib", "src", "android", "gradle.dart"}, false)
c.Assert(r, Equals, NoMatch)
}