-
Notifications
You must be signed in to change notification settings - Fork 299
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
g:gitgutter_diff_base () is invalid #880
Comments
Let me also add this is only happening when I am on Windows. On Ubuntu and Fedora it seems to run fine. The plugin still works but this just shows up whenever I open a file. |
Please could you turn on logging ( |
@airblade thanks so much for responding! So this helped me figure out what the issue is, just not too sure how you can go about solving it. From the gitgutter.log I can see the commands that are run and the one that fails looks like this
With the error message that I get back looking like this
When I saw the slashes were missing from the path I knew it was because I was using Git Bash (MinGW64) and how it doesn't always play nicely with windows paths. When I tried running Neovim again from powershell, the error did not come back. As I said, the plugin still seems to function properly but you just get the error message when you open any file. Here is a comparison of the log when neovim is run from Git Bash and Powershell Git Bash
Powershell
|
wrapping all paths in quotes seems to allow the command to run
|
Thanks for digging into that. Adding quotation marks seems like a good idea, though with Windows you never know. I'll try to patch it over the next few days. |
Please could you try this on Git Bash (MinGW64), as well as Powershell, Ubuntu, and Fedora? diff --git i/autoload/gitgutter/diff.vim w/autoload/gitgutter/diff.vim
index 6325ca3..35de9ba 100644
--- i/autoload/gitgutter/diff.vim
+++ w/autoload/gitgutter/diff.vim
@@ -97,6 +97,8 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
let buff_file .= '.'.extension
endif
+ let buff_file = gitgutter#utility#shellescape(buff_file)
+
" Write buffer to temporary file.
" Note: this is synchronous.
call s:write_buffer(a:bufnr, buff_file)
@@ -114,6 +116,8 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
let from_file .= '.'.extension
endif
+ let from_file = gitgutter#utility#shellescape(from_file)
+
" Write file from index to temporary file.
let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#base_path(a:bufnr)
let cmd .= gitgutter#git().' --no-pager show --textconv '.index_name.' > '.from_file.' || exit 0) && (' |
I made those 2 changes for nvim on Git Bash and, well, I am getting a different error this time and suspecting gitgutter isn't the cause of it. This is the error I am receiving now
|
The trace points to the vim-gitgutter/autoload/gitgutter/diff.vim Lines 404 to 413 in 67ef116
I don't know if the problem is escaping backslashes on Git Bash or some difficulty with the temp directory area. What happens if you run it by hand, i.e. Does it work with vim (instead of nvim) on Git Bash? |
Have you had a chance to test this? |
Closing because it's gone quiet. |
I see that #874 exists however that should have been fixed in commit b9e9ad2.
I am on the latest code and still getting this issue.
The text was updated successfully, but these errors were encountered: