You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated the plugin to the latest version before submitting this issue
I have searched the existing issues of lazy.nvim
I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.10.1
Operating system/version
Linux
Describe the bug
Since this commit lazy.nvim unsets GIT_DIR. This was done to not interfere with its internal use of git, as stated in #434. Few months later, this unset GIT_WORK_TREE.
While this is a sane default behavior, it breaks my workflow. I, just like the user of #434, use those variables to manage my dotfiles, but use nvim to edit them, and plugins like gitsigns or the one used to blame lines need those variables to be set.
Adding a way to alter this behavior would be appreciated. For example, right now I'm using this hack:
~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua
131,132c131,134< env.GIT_DIR = nil< env.GIT_WORK_TREE = nil---> if not env.DISISDOT then> env.GIT_DIR = nil> env.GIT_WORK_TREE = nil> end
So if I set DISISDOT set to true, lazy.nvim would not overwrite the other two variables.
If the suggested change is not implemented, this is the workaround I've been using for few weeks and works just fine.
Patch ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua with dots_patch.txt using patch -bf ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua -i /path/to/dots_patch.txt
Remember that lazy.nvim will complain about tampering it's code when updating itself. So you should reverse the patch when applying an update.
If you want to automate the entire process, edit ~/.config/nvim/lua/config/autocmd.lua and add the following autocommands
This will set DISISDOT to true if working with a dotfile
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
pattern= { "*" },
callback=function()
localfile=vim.api.nvim_buf_get_name(0)
ifos.execute(
"/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME ls-files --error-unmatch "..file.." >/dev/null 2>&1"
) ==0then-- $DISISDOT will signal lazy.nvim to not overwrite $GIT_DIR and $GIT_WORK_TREE-- REMEMBER that this works because you changed the behaviour of ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.luavim.env.DISISDOT=truevim.env.GIT_DIR=vim.env.HOME.."/.dotfiles/"vim.env.GIT_WORK_TREE=vim.env.HOMEendend,
})
I'm sorry I didn't explain the issue properly.
The plugins will use those env indeed.
The issue persist only for 'Git Blame Line' (space+g+b) and similar options.
This is probably because 'Git Blame Line' uses float_cmd from lazy.util
and when spawning the floating terminal, lazy unset those git related env vars
This will prompt an error:
git -C . log -n 3 -u -L 99,+1:/home/pcino/dotfiles.conf`
## Error
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.1
Operating system/version
Linux
Describe the bug
Since this commit lazy.nvim unsets GIT_DIR. This was done to not interfere with its internal use of git, as stated in #434. Few months later, this unset GIT_WORK_TREE.
While this is a sane default behavior, it breaks my workflow. I, just like the user of #434, use those variables to manage my dotfiles, but use nvim to edit them, and plugins like gitsigns or the one used to blame lines need those variables to be set.
Adding a way to alter this behavior would be appreciated. For example, right now I'm using this hack:
So if I set DISISDOT set to true, lazy.nvim would not overwrite the other two variables.
If the suggested change is not implemented, this is the workaround I've been using for few weeks and works just fine.
Patch ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua with dots_patch.txt using
patch -bf ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua -i /path/to/dots_patch.txt
Remember that lazy.nvim will complain about tampering it's code when updating itself. So you should reverse the patch when applying an update.
If you want to automate the entire process, edit ~/.config/nvim/lua/config/autocmd.lua and add the following autocommands
Steps To Reproduce
Expected Behavior
The variable should be unset by default, but the user should have the possibility to set them.
The text was updated successfully, but these errors were encountered: