From 1a41ef53a5378d202480a14b13966f976d97efa2 Mon Sep 17 00:00:00 2001 From: "Ilia.Shulgin" Date: Thu, 11 Jul 2024 08:18:11 +0200 Subject: [PATCH] [git] Convert GitPushSpecParser to kotlin GitOrigin-RevId: e20321c5e0f9be5b2498a2b466e6603d702d72d8 --- plugins/git4idea/src/git4idea/push/GitPushSpecParser.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/push/GitPushSpecParser.kt b/plugins/git4idea/src/git4idea/push/GitPushSpecParser.kt index 5dd6557d761d..09fcd7ca1b8b 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushSpecParser.kt +++ b/plugins/git4idea/src/git4idea/push/GitPushSpecParser.kt @@ -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) } }