[eel-vcs][git] autodetect WSL distribution type for Git distribution (IJPL-210178)

GitOrigin-RevId: ff9ed8e0bef41e5379bb05b2d9634371da4d15f1
This commit is contained in:
Dmitry Zhuravlev
2025-10-06 16:22:48 +00:00
committed by intellij-monorepo-bot
parent 7cc0961bf9
commit 4275405b82
4 changed files with 16 additions and 2 deletions
+2
View File
@@ -106,6 +106,7 @@ jvm_library(
"//platform/eel-provider",
"//platform/eel",
"//platform/platform-impl/recentProjects",
"//platform/platform-impl/eel:ide-impl-wsl",
],
exports = [
"//platform/dvcs-api:vcs-dvcs",
@@ -219,6 +220,7 @@ jvm_library(
"//platform/eel-provider",
"//platform/eel",
"//platform/platform-impl/recentProjects",
"//platform/platform-impl/eel:ide-impl-wsl",
],
exports = [
"//platform/dvcs-api:vcs-dvcs",
+1
View File
@@ -123,5 +123,6 @@
<orderEntry type="module" module-name="intellij.platform.eel.provider" />
<orderEntry type="module" module-name="intellij.platform.eel" />
<orderEntry type="module" module-name="intellij.platform.ide.recentProjects" />
<orderEntry type="module" module-name="intellij.platform.ide.impl.wsl" />
</component>
</module>
@@ -7,6 +7,7 @@
<module name="intellij.platform.vcs.dvcs"/>
<module name="intellij.platform.vcs.log.graph.impl"/>
<module name="intellij.platform.collaborationTools"/>
<module name="intellij.platform.ide.impl.wsl"/>
</dependencies>
<actions resource-bundle="messages.GitBundle">
@@ -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.wsl.WSLDistribution;
@@ -11,7 +11,10 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.platform.eel.EelApi;
import com.intellij.platform.eel.EelOsFamily;
import com.intellij.platform.eel.provider.EelNioBridgeServiceKt;
import com.intellij.platform.eel.provider.LocalEelDescriptor;
import com.intellij.platform.ide.impl.wsl.WslEelDescriptor;
import com.intellij.util.concurrency.AppJavaExecutorUtil;
import git4idea.commands.Git;
import git4idea.commands.GitCommand;
@@ -149,6 +152,13 @@ class GitExecutableFileTester {
workingDirectory = Path.of(distribution.getWindowsPath("/"));
} else if (executable instanceof GitExecutable.Eel) {
EelApi eelApi = ((GitExecutable.Eel)executable).getEel();
if (eelApi.getDescriptor() instanceof WslEelDescriptor) {
WSLDistribution distribution = ((WslEelDescriptor) eelApi.getDescriptor()).getDistribution();
type = distribution.getVersion() == 1 ? GitVersion.Type.WSL1 : GitVersion.Type.WSL2;
}
else if (eelApi.getDescriptor() instanceof LocalEelDescriptor && eelApi.getPlatform().getOsFamily().equals(EelOsFamily.Posix)) {
type = GitVersion.Type.UNIX;
}
workingDirectory = EelNioBridgeServiceKt.asNioPath(eelApi.getUserInfo().getHome());
}
@@ -198,4 +208,4 @@ class GitExecutableFileTester {
return myFileLastModifiedTimestamp;
}
}
}
}