All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avito.impact.configuration.Branches.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

The newest version!
package com.avito.impact.configuration

import io.github.azagniotov.matcher.AntPathMatcher

internal fun isBranchProtected(branch: String, protectedBranches: Set): Boolean {
    require(branch.isNotBlank()) { "trying to check empty branch" }
    return if (protectedBranches.isEmpty()) {
        false
    } else {
        protectedBranches.any { pattern ->

            require(pattern.isNotBlank()) { "protectedBranches pattern for $branch must non-empty" }

            val patternMatcher = AntPathMatcher.Builder()
                .withIgnoreCase()
                .withPathSeparator('/')
                .build()

            patternMatcher.isMatch(pattern, branch)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy