timbrel / GitSavvy

Full git and GitHub integration with Sublime Text
MIT License
1.91k stars 137 forks source link

Lookup real git executable on Windows #1544

Open kaste opened 2 years ago

kaste commented 2 years ago

it is quiOn Windows, where git typically returns a wrapper executable, e.g. C:\Dev\Git\cmd\git.exe. This wrapper is slower than using the real executable, for example located at

$ git --exec-path
C:/Dev/Git/mingw64/libexec/git-core

The complete absolute path to the binary is then "git_path": "C:\\Dev\\Git\\mingw64\\libexec\\git-core\\git.exe"

Initial conversation: https://github.com/magit/magit/pull/1289 The current code in magit is quite complex. I think we can just use git --exec-path.

On my system modifying PATH is also not necessary.

kaste commented 2 years ago

Timings using C:\Dev\Git\cmd\git.exe

 (D) [ 41ms] $ git status --porcelain -z -b
 (D) [ 45ms] $ git status --porcelain -z -b
 (D) [ 43ms] $ git status --porcelain -z -b
 (D) [ 43ms] $ git status --porcelain -z -b
 (D) [ 42ms] $ git status --porcelain -z -b

and using C:/Dev/Git/mingw64/libexec/git-core:

 (D) [ 33ms] $ git status --porcelain -z -b
 (D) [ 35ms] $ git status --porcelain -z -b
 (D) [ 36ms] $ git status --porcelain -z -b
 (D) [ 35ms] $ git status --porcelain -z -b
 (D) [ 27ms] $ git status --porcelain -z -b
 (D) [ 31ms] $ git status --porcelain -z -b
 (D) [ 36ms] $ git status --porcelain -z -b