airblade / vim-gitgutter

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
MIT License
8.37k stars 297 forks source link

g:gitgutter_diff_base () is invalid #874

Closed ta3pks closed 12 months ago

ta3pks commented 12 months ago

What is the latest commit SHA in your installed vim-gitgutter? 6efb835 What vim/nvim version are you on? 0.9.4

Everything was fine after doing an update to gitgutter started receiving this error message on startup

dimonomid commented 12 months ago

Yeah I just tested it too, and indeed, the last commit (6efb835aa2de69daaf164e1605decf4987609889) breaks it. It's supposed to fix another issue from 2h ago: https://github.com/airblade/vim-gitgutter/issues/873, but apparently it broke others.

airblade commented 12 months ago

Please could you apply this patch?

diff --git i/autoload/gitgutter/utility.vim w/autoload/gitgutter/utility.vim
index 9c196fc..ba50d3c 100644
--- i/autoload/gitgutter/utility.vim
+++ w/autoload/gitgutter/utility.vim
@@ -291,7 +291,7 @@ function! s:obtain_file_renames(bufnr, base)
   let [out, error_code] = gitgutter#utility#system(gitgutter#utility#cd_cmd(a:bufnr, cmd))
   if error_code
     " Assume the problem is the diff base.
-    call gitgutter#utility#warn('g:gitgutter_diff_base ('.a:base.') is invalid')
+    echom error_code ' :: ' out
     return {}
   endif
   for line in split(out, '\n')

And let me know what message it prints?

airblade commented 12 months ago

Never mind, I've seen the problem. The -c flag applies to git, not the diff subcommand.

ta3pks commented 12 months ago

thanks for the swift action :)