tanvirtin / vgit.nvim

Visual git plugin for Neovim
MIT License
583 stars 11 forks source link

fix(git show): allow cwd outside root git dir #334

Closed zdleaf closed 1 year ago

zdleaf commented 1 year ago

Hi tanvirtin,

When cwd is outside of the root git directory, calls to git show fail due to the ./ prefix added to the filename. I believe this is not required, since we should be using a relative filename from the project git root dir and/or setting -C to self.cwd.

To replicate, open any file in a root git directory, :cd to some other dir and :VGit buffer_blame_preview

...ocal/share/nvim/plugged/vgit.nvim/lua/vgit/core/loop.lua:43: coroutine failed :: function: 0x7f583cfe90f8                                                                                                                                                   
stack traceback:                                                                                                                                                                                                                                               
        [C]: in function 'on_exit'                                                                                                                                                                                                                             
        ...hare/nvim/plugged/vgit.nvim/lua/vgit/core/ReadStream.lua:79: in function <...hare/nvim/plugged/vgit.nvim/lua/vgit/core/ReadStream.lua:63>                                                                                                           
stack traceback:                                                                                                                                                                                                                                               
        [C]: in function 'resume_coroutine'                                                                                                                                                                                                                    
        ...ocal/share/nvim/plugged/vgit.nvim/lua/vgit/core/loop.lua:43: in function <...ocal/share/nvim/plugged/vgit.nvim/lua/vgit/core/loop.lua:22>

Related to #79