zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
603 stars 71 forks source link

[BUG] WSL path to git not found (Outdated branches calculation failed) #560

Open HenryGessau opened 1 week ago

HenryGessau commented 1 week ago

Describe the bug When running a JetBrains IDE in Windows with a project in a WSL, GitToolBox causes an IDE exception when calculating outdated branches due to an incorrect path to git.

To Reproduce Steps to reproduce the behavior:

  1. Install a JetBrains IDE in Windows and add GitToolBox.
  2. Install WSL2 in Windows and create a git repository in WSL.
  3. Open a new project in Jetbrains IDE by specifying the WSL path, for example, \\wsl.localhost\Ubuntu-22.04\home\henry\dev\github.com\org\repo
  4. Commit a change to the repo using GitToolBox.
  5. See the exception in "IDE Internal Errors".

Expected behavior Expected not to see the exception error.

Plugin version

  zielu.gittoolbox (500.2.10+233)

IDE version

WebStorm 2024.1.5
Build #WS-241.18034.50, built on June 19, 2024

IDE Internal Errors entry

Outdated branches calculation failed

java.lang.RuntimeException: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\usr\bin\git" (in directory "\\wsl.localhost\Ubuntu-22.04\home\henry\dev\github.com\org\repo"): CreateProcess error=2, The system cannot find the file specified
    at zielu.gittoolbox.V.J.v(J.java:59)
    at zielu.gittoolbox.V.g.M(g.java:2)
    at zielu.gittoolbox.V.t.t(t.java:4)
    at zielu.gittoolbox.O.q.B(q.java:3)
    at zielu.gittoolbox.O.e.a(e.java:21)
    at zielu.gittoolbox.O.y.x(y.java:6)
    at zielu.gittoolbox.O.y.O(y.java:39)
    at zielu.gittoolbox.O.P.run(P.java:20)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:250)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
    at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:46)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:250)
    at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:500)
    at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
    at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
    at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:86)
    at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:81)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\usr\bin\git" (in directory "\\wsl.localhost\Ubuntu-22.04\home\henry\dev\github.com\org\repo"): CreateProcess error=2, The system cannot find the file specified
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:367)
    at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:86)
    at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:46)
    at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:41)
    at zielu.gittoolbox.V.z.<init>(z.java:1)
    at zielu.gittoolbox.V.J.p(J.java:34)
    at zielu.gittoolbox.V.J.l(J.java:65)
    at zielu.gittoolbox.V.J.s(J.java:11)
    at zielu.gittoolbox.V.J.v(J.java:55)
    ... 36 more
Caused by: java.io.IOException: Cannot run program "\usr\bin\git" (in directory "\\wsl.localhost\Ubuntu-22.04\home\henry\dev\github.com\org\repo"): CreateProcess error=2, The system cannot find the file specified
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:491)
    at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:464)
    at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:357)
    ... 44 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.base/java.lang.ProcessImpl.create(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
    ... 48 more
zielu commented 6 days ago

Hi, while I investigate and fix it, as a workaround to avoid the error, you can disable squashed-merged branch cleanup in Settings > Version Control > GitToolBox > Branches > Detect squashed-merged branches

zielu commented 2 days ago

Hi, a small update - I was missing wsl support for process of finding squashed branches. Fix is on the way, I hope it will ready tomorrow.

zielu commented 1 day ago

Fix is taking longer than expected but it's close to ready.