[git] Convert GitPushSpecParser to kotlin

GitOrigin-RevId: e20321c5e0f9be5b2498a2b466e6603d702d72d8
This commit is contained in:
Ilia.Shulgin
2024-07-11 08:18:11 +02:00
committed by intellij-monorepo-bot
parent 2efa478f44
commit 1a41ef53a5

View File

@@ -3,6 +3,7 @@
package git4idea.push
import com.intellij.openapi.diagnostic.thisLogger
import git4idea.GitBranch
import git4idea.GitUtil
import git4idea.branch.GitBranchUtil
import git4idea.repo.GitRepository
@@ -43,9 +44,10 @@ internal object GitPushSpecParser {
val strippedSpecSource = GitBranchUtil.stripRefsPrefix(specSource)
val strippedSourceBranch = GitBranchUtil.stripRefsPrefix(sourceBranch)
val fullSourceBranch = GitBranch.REFS_HEADS_PREFIX + strippedSourceBranch
if (strippedSpecSource == GitUtil.HEAD ||
specSource == sourceBranch ||
specSource == fullSourceBranch ||
specSource == strippedSourceBranch
) {
return specTarget
@@ -53,8 +55,8 @@ internal object GitPushSpecParser {
if (specSource.endsWith("*")) {
val sourceWoStar = specSource.substring(0, specSource.length - 1)
if (sourceBranch.startsWith(sourceWoStar)) {
val starMeaning = sourceBranch.substring(sourceWoStar.length)
if (fullSourceBranch.startsWith(sourceWoStar)) {
val starMeaning = fullSourceBranch.substring(sourceWoStar.length)
return specTarget.replace("*", starMeaning)
}
}