mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[git] Convert GitPushSpecParser to kotlin
GitOrigin-RevId: e20321c5e0f9be5b2498a2b466e6603d702d72d8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2efa478f44
commit
1a41ef53a5
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user