diff --git a/utils/src/main/kotlin/LicenseFilenamePatterns.kt b/utils/src/main/kotlin/LicenseFilenamePatterns.kt index c8a651d67b764..3a08b34e25039 100644 --- a/utils/src/main/kotlin/LicenseFilenamePatterns.kt +++ b/utils/src/main/kotlin/LicenseFilenamePatterns.kt @@ -97,12 +97,14 @@ object LicenseFilenamePatterns { directory: String, filenamePatterns: Collection ): List { - val patternsForDir = filenamePatterns.map { + val distinctPatterns = filenamePatterns.toSet() + + val patternsForDir = distinctPatterns.map { getFileGlobForDirectory(File(directory).invariantSeparatorsPath, it, true) } val patternsForAncestorDirs = getAllAncestorDirectories(directory).flatMap { dir -> - filenamePatterns.map { getFileGlobForDirectory(dir, it, false) } + distinctPatterns.map { getFileGlobForDirectory(dir, it, false) } } return (patternsForDir + patternsForAncestorDirs).sorted()