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

Commit

Permalink
Merge pull request #924 from fkorotkov/fedor/fix-issue-923
Browse files Browse the repository at this point in the history
Fixed an edge case for .gitignore
  • Loading branch information
mcuadros committed Aug 20, 2018
2 parents 7b6c126 + 7b4a837 commit 1cef577
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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)
}

0 comments on commit 1cef577

Please sign in to comment.