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

Inconsistent path between shell types causing inconsistent Git version and tools if Git is installed locally and a different version than embeded Git #2373

Closed
1 of 3 tasks
daxgames opened this issue Aug 13, 2020 · 6 comments
Labels
👀 Awaiting Response Waiting to hear back from the issue reporter.

Comments

@daxgames
Copy link
Member

Purpose of the issue

  • Bug report (encountered problems/errors)
  • Feature request (request for new functionality)
  • Question

Version Information

Cmder Version: 1.3.16

Windows Version: 10 2004 Build 19041.388
Locally installed Git: 2.27.0.windows.1
Embedded Git Version: 2.28.0.windows.1

Description of the issue

Inconsistent path between shell types causing inconsistent Git version and tools if Git is installed locally and a different version than embeded Git

  1. Git is installed locally in C:\Program Files\Git.
  2. Launching cmd::Cmder and powershell::powershell shells result in inconsistent path between shell types causing inconsistent Unix tools availability.
  3. If Git is installed locally and a different version than Cmder embedded Git then Git version is also inconsistent.

See screenshot of path from cmd::cmder, powershell::powershell, bash::bash split by delimiter into separate lines:

image

Result of inconsistencies in each shell:

  • cmd::cmder
    • Git Version: 2.28.0.windows.1
    • Other Unix tools are available for use in the path.
  • powershell::powershell
    • Git Version: 2.27.0.windows.1
    • Other Unix tools are NOT available for use in the path.
  • bash::bash Git Version: 2.27.0.windows.1
    • Git Version: 2.27.0.windows.1
    • Other Unix tools are available for use in the path.

Proposed Fix:

  • Use the newer Git version in all shells.
  • If Git is installed and configured locally and embedded Git is older.
    • Today we add Unix tools from the local install to the path for cmd::cmder but not powershell::powershell
    • Proposal:
      • Use the current path and make no changes regarding Git and Unix tools only add Cmder folders.
  • If Git is NOT installed and configured locally and we have embedded Git.
    • Today we add %cmder_root%\vendor\git-for-windows\cmd to the front of the path
      and add %cmder_root%\vendor\git-for-windows\mingw64\bin and %cmder_root%\vendor\git-for-windows\usr\bin after C:\Windows to the end of the path
      using embedded Git version and preferring Windows tools.
  • If Git is installed and configured locally and embedded Git is newer
    • Today we add Unix tools to the path for cmd::cmder but not powershell::powershell
    • Match the path config of the locally installed version using the embedded git install
      • Example 1: If locally installed Git only adds C:\Program Files\Git\cmd to the path
        then cmd::cmder and powershell::powershell should do the same by
        adding %cmder_root%\vendor\git-for-windows\cmd to the front of the path
        overriding locally installed Git using embedded version.
      • Example 2: If locally installed Git adds C:\Program Files\Git\cmd to the path and also C:\Program Files\mingw64\bin and C:\Program Files\usr\bin after C:\Windows
        then cmd::cmder and powershell::powershell should do the same by
        adding %cmder_root%\vendor\git-for-windows\cmd to the front of the path
        and adding C:\Program Files\mingw64\bin and C:\Program Files\usr\bin after C:\Windows to the end of the path
        overriding locally installed Git using embedded version and preferring Windows tools.
      • Example 3: If locally installed Git adds C:\Program Files\Git\cmd to the path and C:\Program Files\mingw64\bin and C:\Program Files\usr\bin before C:\Windows\System32
        then cmd::cmder and powershell::powershell should do the same by
        adding %cmder_root%\vendor\git-for-windows\cmd and C:\Program Files\mingw64\bin and C:\Program Files\usr\bin to the front of the path
        overriding locally installed version and preferring Unix tools.

Comments?

@daxgames
Copy link
Member Author

@DRSDavidSoft I am trying to duplicate the cmd::Cmder capability of discovering the git version if user and vendored installs exist in powershell and bash sessions. I am unsure what the function :is_git_shim does or if it is even necessary. Can you explain it?

@daxgames
Copy link
Member Author

So I guess no one cares. Oh well the lack of feature parity between shells bugs me and I just like to code so I have already written the Powershell modifications to do this. I will open a PR so people can test it when I am completely finished.

@DRSDavidSoft
Copy link
Contributor

@daxgames Sorry for the late response, I was busy. I took a look at :is_git_shim and I don't recall writing that, instead I was also puzzled when I saw it. In #1658 you can see that the routine existed before my modifications.

I will look more into it so I can understand the purpose behind it. I feel like the same regarding shell inconsistencies, and in any case, I'd like to appreciate what you're doing to address them. Please, don't let this discourage you from improving upon the codebase.

I will respond when I find anything on git "shim".

@DRSDavidSoft
Copy link
Contributor

DRSDavidSoft commented Aug 28, 2020

@daxgames Found some relevant info: #1905

If the git found is a shim, we need to follow the path to the actual git
directory to set the GIT_INSTALL_ROOT variable.
This happens when installing git via scoop for example.
~@narnaud


@daxgames It seems that Shim is actually a Scoop component -- so this routine is probably used in order to find the correct installation path for Git, when installed via Scoop.

Since scoop is a package installer written in Powershell, I believe it will be beneficial to also provide the Git Shim path discovery function to the Cmder's Powershell profile.

@daxgames
Copy link
Member Author

@DRSDavidSoft my bad. I thought you wrote this. Thanks for doing the research and making up for my lack of effort.

@DRSDavidSoft
Copy link
Contributor

@daxgames No problems, I'm looking forward to see your modifications, hopefully also containing the shim detection!

@stale stale bot added the 👀 Awaiting Response Waiting to hear back from the issue reporter. label Oct 4, 2020
@stale stale bot closed this as completed Oct 11, 2020
This was referenced Dec 11, 2020
@cmderdev cmderdev deleted a comment from stale bot Jun 6, 2024
@cmderdev cmderdev deleted a comment from stale bot Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 Awaiting Response Waiting to hear back from the issue reporter.
Projects
None yet
Development

No branches or pull requests

2 participants