mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git: improve check of Git executable which supports update (IJPL-210178)
Simplify: check only Windows-specific local distribution, do not rely on all kind WSL-related distributions detection. Also, automatically support any potential new Git distribution types where update/install are not supported. Follow-up: d99420567a2f5196207af9c444a4dae7108ca72f GitOrigin-RevId: af2e8c199a4112bcf52c96590be5a2d86083ba95
This commit is contained in:
committed by
intellij-monorepo-bot
parent
418f329ce1
commit
beaf3f9a33
@@ -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<GitVersion> {
|
||||
public boolean isNull() {
|
||||
return getType() == Type.NULL;
|
||||
}
|
||||
|
||||
public boolean isWSL() {
|
||||
return switch (getType()) {
|
||||
case WSL1, WSL2 -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user