IDEA-283434 git: prefer WSL executable when cloning projects into WSL

GitOrigin-RevId: 4cf2e371960c3651f7623e5ce582b32b88cae079
This commit is contained in:
Aleksey Pivovarov
2021-12-01 10:23:35 +00:00
committed by intellij-monorepo-bot
parent 203425451e
commit 6ebb6c7631
2 changed files with 12 additions and 1 deletions
@@ -183,7 +183,8 @@ public class GitImpl extends GitImplBase {
@NotNull final String clonedDirectoryName, final GitLineHandlerListener @NotNull ... listeners) {
return runCommand(() -> {
// do not use per-project executable for 'clone' command
GitLineHandler handler = new GitLineHandler(null, parentDirectory, GitCommand.CLONE);
GitExecutable executable = GitExecutableManager.getInstance().getExecutableFor(parentDirectory);
GitLineHandler handler = new GitLineHandler(null, parentDirectory, executable, GitCommand.CLONE, emptyList());
handler.setSilent(false);
handler.setStderrSuppressed(false);
handler.setUrl(url);
@@ -107,6 +107,16 @@ public class GitExecutableManager {
return path;
}
@NotNull
public GitExecutable getExecutableFor(@NotNull File gitDirectory) {
String path = GitVcsApplicationSettings.getInstance().getSavedPathToGit();
if (path == null) {
WSLDistribution wslDistribution = WslPath.getDistributionByWindowsUncPath(gitDirectory.getPath());
path = myExecutableDetector.detect(wslDistribution);
}
return getExecutable(path);
}
@NotNull
public GitExecutable getExecutable(@Nullable Project project) {
String path = getPathToGit(project);