diff --git a/plugins/git4idea/src/git4idea/config/GitVersion.java b/plugins/git4idea/src/git4idea/config/GitVersion.java index 49889aa0b41e..77dc2d307e90 100644 --- a/plugins/git4idea/src/git4idea/config/GitVersion.java +++ b/plugins/git4idea/src/git4idea/config/GitVersion.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.config; import com.intellij.execution.ExecutableValidator; @@ -303,12 +303,4 @@ public final class GitVersion implements Comparable { public boolean isNull() { return getType() == Type.NULL; } - - public boolean isWSL() { - return switch (getType()) { - case WSL1, WSL2 -> true; - default -> false; - }; - } - } diff --git a/plugins/git4idea/src/git4idea/config/GitVersionUpdateInSettings.kt b/plugins/git4idea/src/git4idea/config/GitVersionUpdateInSettings.kt index af20137df3f4..e36e1b9b420c 100644 --- a/plugins/git4idea/src/git4idea/config/GitVersionUpdateInSettings.kt +++ b/plugins/git4idea/src/git4idea/config/GitVersionUpdateInSettings.kt @@ -55,16 +55,11 @@ internal class GitVersionUpdateSettingsEntryProvider : SettingsEntryPointAction. val versionToUpdate = versionChecker.newAvailableVersion val gitNotInstalled = versionChecker.gitNotInstalled - if (versionToUpdate.isNull || versionToUpdate.isWSL) { - presentation.isEnabledAndVisible = false - } - else { - presentation.text = - if (gitNotInstalled) GitBundle.message("git.executable.install.available", versionToUpdate.presentation) - else GitBundle.message("git.executable.new.version.update.available", versionToUpdate.presentation) + presentation.text = + if (gitNotInstalled) GitBundle.message("git.executable.install.available", versionToUpdate.presentation) + else GitBundle.message("git.executable.new.version.update.available", versionToUpdate.presentation) - presentation.isEnabledAndVisible = true - } + presentation.isEnabledAndVisible = isUpdateSupported(versionToUpdate) } override fun actionPerformed(e: AnActionEvent) { @@ -129,7 +124,7 @@ internal class GitNewVersionChecker(private val project: Project, private val cs val currentVersion = GitExecutableManager.getInstance().getVersionOrIdentifyIfNeeded(project) gitNotInstalled = currentVersion.isNull - if (currentVersion.isWSL) { + if (!isUpdateSupported(currentVersion)) { newAvailableVersion = currentVersion return@withContext } @@ -147,6 +142,15 @@ internal class GitNewVersionChecker(private val project: Project, private val cs } } } + +} + +private fun isUpdateSupported(version: GitVersion): Boolean { + return when (version.type) { + GitVersion.Type.MSYS -> true + GitVersion.Type.CYGWIN -> true + else -> false + } } private val afterIdleCheckRegistryValue get() = Registry.intValue("git.version.check.minutes")