Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLens not using Automation Shell? #2057

Open
edemaine opened this issue Jun 27, 2022 · 5 comments
Open

GitLens not using Automation Shell? #2057

edemaine opened this issue Jun 27, 2022 · 5 comments
Assignees
Labels
bug Something isn't working support-triaged Support has reviewed, verified, or reproduced this

Comments

@edemaine
Copy link

  • GitLens Version: 12.1.1
  • Git Version: Run git --version
  • VSCode Version: 1.16.1
  • OS Version: Windows 10 Pro Education 21H2
  • log.txt

I'm in a scenario where the Git extension works fine, but GitLens does not work. See attached log.

Conjecture: GitLens uses the default terminal instead of the default automation terminal. My default terminal is a Cygwin shell (which I prefer to use in Terminal). My default automation shell is Windows Command Prompt, as needed for running Git from VSCode. My shell configuration is as follows:

    "terminal.integrated.defaultProfile.windows": "Cygwin ZSH",
    "terminal.integrated.automationProfile.windows": {
      "path": "${env:windir}\\System32\\cmd.exe",
      "args": [],
      "icon": "terminal-cmd"
    },
    "terminal.integrated.profiles.windows": {
      "PowerShell": {
        "source": "PowerShell",
        "icon": "terminal-powershell"
      },
      "Command Prompt": {
        "path": [
          "${env:windir}\\Sysnative\\cmd.exe",
          "${env:windir}\\System32\\cmd.exe"
        ],
        "args": [],
        "icon": "terminal-cmd"
      },
      "Git Bash": {
        "source": "Git Bash"
      },
      "Cygwin ZSH": {
        "path": [
          "c:\\cygwin\\bin\\zsh.exe",
          "c:\\cygwin64\\bin\\zsh.exe"
        ],
        "args": [
          "-i"
        ],
        "env": {
          "ZSH_HIGHLIGHT_DISABLE": "1"
        }
      }
    },

It seems that GitLens uses the Git extension for some interactions with Git, but directly runs Git for other interactions. In the latter case, perhaps it's running the wrong shell?

To clarify the log, "C:\Program Files\Git\cmd\git.exe" runs fine in Command Prompt, but does not run in a Cygwin shell. You can also see the /cygdrive/c/... path in the log, which is another sign that it's running in the Cygwin shell.

@edemaine edemaine added potential-bug triage Needs to be looked at labels Jun 27, 2022
@eamodio eamodio added bug Something isn't working and removed potential-bug labels Apr 11, 2023
@Elias-Graf
Copy link

Elias-Graf commented Jun 13, 2023

For me, the extension does not work at all in some cases, because the shell I'm using, is not compatible with the cmd / PowerShell format. I'm using the Nushell, and if I try to delete a branch from the graph, for example, I get the following output:

"c:/Program Files/Git/cmd/git.exe" -C "PATH" -c "core.editor=code-insiders --wait --reuse-window" branch --delete BRANCH_NAME
Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[entry #1:1:1]
 1"c:/Program Files/Git/cmd/git.exe" -C "PATH" -c "core.editor=code-insiders --wait --reuse-window" branch --delete BRANCH_NAME
   ·                                     ─┬
   ·                                      ╰── expected operator
   ╰────

GitLense shouldn't really start in this shell, since I configured cmd to be the automation shell on Windows:

"terminal.integrated.automationProfile.windows": {
  "path": "cmd"
},

I should have the newest version of GitLens installed v2023.6.1205 pre-release.

@jkelroy jkelroy added needs-more-info Needs further information, steps, details, etc. and removed triage Needs to be looked at labels Jun 19, 2023
@jkelroy
Copy link

jkelroy commented Jun 19, 2023

Hello @edemaine and @Elias-Graf, looking into this issue I am unable to reproduce so it would be helpful if you can provide more context. For example, here is what I tried:

  • in Windows Terminal, set my default profile to both Nushell and Cygwin.
  • in VS Code, Open User Settings (JSON)
  • set terminal.integrated.automationProfile.windows to cmd - I tried both of your included settings above

After this, I was able to work with GitLens as expected i.e. delete a branch. Is there any additional setup required to reproduce this?

@Elias-Graf
Copy link

Elias-Graf commented Jun 20, 2023

Hello @jkelroy, thanks for looking into this.

I can reproduce it with the following settings.json:

{
    "gitlens.graph.layout": "editor",
    "terminal.integrated.profiles.windows": {
        "nu": {
            "path": "nu"
        }
    },
    "terminal.integrated.defaultProfile.windows": "nu",
    "terminal.integrated.automationProfile.windows": {
        "path": "cmd"
    }
}

VS Code Version:

Version: 1.79.2 (user setup)
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:57:04.379Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22621

GitLense Version:
v2023.6.1912 Pre-Release

This was performed on a completely fresh installation of VS Code through the winget package manager. I don't think I have any other configuration active.

Have you added the following line to your settings "terminal.integrated.defaultProfile.windows": "nu"? Doing so will cause the + button (New Terminal) to launch a nu shell, which will apparently also be used for some automation tasks.

@jkelroy jkelroy removed the needs-more-info Needs further information, steps, details, etc. label Jun 20, 2023
@jkelroy
Copy link

jkelroy commented Jun 20, 2023

Thanks for the additional information - I was able to reproduce this issue using those settings.

@axosoft-ramint axosoft-ramint self-assigned this Jun 21, 2023
@jkelroy jkelroy added the support-triaged Support has reviewed, verified, or reproduced this label Jul 18, 2023
@Elias-Graf
Copy link

Elias-Graf commented Sep 13, 2023

Hello, what's the ETA on this? I'm having this issue all the time, and having this fixed would be a huge time saver for me. I really enjoy the product otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working support-triaged Support has reviewed, verified, or reproduced this
Projects
None yet
Development

No branches or pull requests

5 participants