Skip to content

Commit 0f98634

Browse files
committed
Add caveat to setting of Windows git executable
See airblade#668.
1 parent 68a8cb3 commit 0f98634

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.mkd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ nvim -u NONE -c "helptags vim-gitgutter/doc" -c q
7777

7878
### Windows
7979

80-
I recommend configuring vim-gitgutter with the full path to your git executable. For example:
80+
There is a potential risk on Windows due to `cmd.exe` prioritising the current folder over folders in `PATH`. If you have a file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder, it will be executed instead of git whenever the plugin calls git.
81+
82+
You can avoid this risk by configuring the full path to your git executable. For example:
8183

8284
```viml
85+
" This path probably won't work
8386
let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'
8487
```
8588

86-
This is to avoid a problem which occurs if you have file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder. `cmd.exe` prioritises the current folder over folders in `PATH` and will try to execute your file instead of the `git` binary.
89+
Unfortunately I don't know the correct escaping for the path - if you do, please let me know!
8790

8891

8992
### Getting started

doc/gitgutter.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,20 @@ Neovim:~
6363
===============================================================================
6464
WINDOWS *gitgutter-windows*
6565

66-
I recommend configuring vim-gitgutter with the full path to your git executable.
66+
There is a potential risk on Windows due to `cmd.exe` prioritising the current
67+
folder over folders in `PATH`. If you have a file named `git.*` (i.e. with
68+
any extension in `PATHEXT`) in your current folder, it will be executed
69+
instead of git whenever the plugin calls git.
70+
71+
You can avoid this risk by configuring the full path to your git executable.
6772
For example:
6873
>
74+
" This path probably won't work
6975
let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'
7076
<
71-
This is to avoid a problem which occurs if you have file named "git.*" (i.e.
72-
with any extension in "PATHEXT") in your current folder. "cmd.exe" prioritises
73-
the current folder over folders in 'PATH' and will try to execute your file
74-
instead of the "git" binary.
77+
78+
Unfortunately I don't know the correct escaping for the path - if you do,
79+
please let me know!
7580

7681

7782
===============================================================================

0 commit comments

Comments
 (0)