git-messenger.vim
git-messenger.vim copied to clipboard
Outside repository error on windows with msys/git
Giving a full path to msys/git doesn't seem to work well. When :GitMesseger is executed on the C:\Users\hokorobi\vimfiles\vimrc, it will be as follows.
git-messenger: fatal: 'C:\Users\hokorobi\vimfiles\vimrc' is outside repository at '/home/hokorobi/vimfiles': `git --no-pager blame C:\Users\hokorobi\vimfiles\vimrc -L 1,+1 --porcelain` exited with non-zero status 128
- Would you try exactly the same command from command line directly and confirm you can get the same error? It is weird that
git -C
is not used. My assumption is that git-messenger.vim is always usinggit -C {dir}
to run Git commands in specific directory. It may not be working. - If you have installed Git for Windows, would you also try its
git
command by settingg:git_messenger_git_command
?
-
I get the same error on the command line.
C:\Users\hokorobi\vimfiles>git --no-pager blame C:\Users\hokorobi\vimfiles\vimrc -L 1,+1 --porcelain fatal: 'C:\Users\hokorobi\vimfiles\vimrc' is outside repository at '/home/hokorobi/vimfiles'
It seems that msys git expects a UNIX-like path. It's not an error this.
C:\Users\hokorobi\vimfiles>git --no-pager blame /home/hokorobi/vimfiles/vimrc -L 1,+1 --porcelain
-
I haven't installed Git for Windows, so I can't try it, but I've heard that VSCode Git doesn't cause an error.
Thank you for the investigation. Regarding to 1., this command is not what I expected. My expectation was:
git --no-pager -C C:\Users\hokorobi\vimfiles blame C:\Users\hokorobi\vimfiles\vimrc -L 1,+1 --porcelain
Would you ensure above command also does not work?
It seems that msys git expects a UNIX-like path
It looks root cause of this issue. I'm not user of MSYS so not familiar with it. Would you answer below questions if you know the answer?
- how can we detect MSYS git? (for example, from path of
git
command) - is there any utility which converts Windows file path to MSYS's unix-like path? For example, cygwin has
cygpath
utility command
Since using relative path is problematic, I want to solve this issue by converting Windows path to Unix-like path when running git
command.
- It was the same result.
C:\Users\hokorobi\vimfiles>git --no-pager -C C:\Users\hokorobi\vimfiles blame C:\Users\hokorobi\vimfiles\vimrc -L 1,+1 --porcelain fatal: 'C:\Users\hokorobi\vimfiles\vimrc' is outside repository at '/home/hokorobi/vimfiles'
how can we detect MSYS git? (for example, from path of git command)
$PATH
has a path with git
in it.
is there any utility which converts Windows file path to MSYS's unix-like path? For example, cygwin has cygpath utility command
I will investigate.
MSYS also has cygpath
.
Git for Windows works fine. It may be good to say that it doesn't work in MSYS Git.
Thank you for the investigation. It is very helpful.
$PATH has a path with git in it.
I apologize that my question was bad. My intention was that I wanted to detect git
command which was installed with MSYS. Hence we can convert Windows path to Unix-like path only when the git
command is installed via MSYS.
If git
is installed in MSYS-specific directory (e.g. including 'msys' in its path), we can detect it by return value from exepath()
.
MSYS also has cygpath.
Thank you. My understanding is that the path converted by cygpath
is used for MSYS Git, though I'm not sure this is correct.
It may be good to say that it doesn't work in MSYS Git.
At least for now, it should be noted. Thank you for suggestion. I'll add note to README.
Thank you for writing the document. You may also close this issue.
I'll keep this issue open because this issue is not solved.