Skip to content

Commit

Permalink
Fix globs ending with **
Browse files Browse the repository at this point in the history
According to https://git-scm.com/docs/gitignore a trailing `**` in a glob has to match with any file in the directory that matches the glob without that trailing `**`.

Given glob "**/Test*/**" the file "src/Foo/TestFoo.kt" should not be matched, and file "src/TestFoo/FooTest.kt" is matched. If the original pattern would be expanded with additional pattern "**/Test*" then both files would have been matched.

Closes #2781
  • Loading branch information
paul-dingemans committed Sep 3, 2024
1 parent 1f8d5d9 commit 8ea9d64
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private fun String?.expandDoubleStarPatterns(): Set<String> {
// trailing "**" matches any file in the directory.
// Given pattern "**/Test*/**" the file "src/Foo/TestFoo.kt" should not be matched, and file "src/TestFoo/FooTest.kt" is
// matched. If the original pattern would be expanded with additional pattern "**/Test*" then both files would have been
// matched.
// matched.
it === parts.last()
}.forEach { doubleStarPart ->
run {
Expand Down

0 comments on commit 8ea9d64

Please sign in to comment.