mirror of
https://github.com/neovim/neovim.git
synced 2026-05-29 16:25:35 +00:00
fix(pack): GIT_DIR/GIT_WORK_TREE env vars may interfere #39279
Problem: With GIT_DIR/GIT_WORK_TREE set, the LSP on the vim.pack.update() confirmation buffer does not show the correct git log on hover. Solution: Temporarily remove the git vars from the environment.
This commit is contained in:
@@ -1463,6 +1463,9 @@ describe('vim.pack', function()
|
||||
-- textDocument/hover
|
||||
local confirm_winnr = api.nvim_get_current_win()
|
||||
local function assert_hover(pos, commit_msg)
|
||||
-- Should not be affected by special environment variables
|
||||
fn.setenv('GIT_WORK_TREE', t.paths.test_source_path)
|
||||
fn.setenv('GIT_DIR', vim.fs.joinpath(t.paths.test_source_path, '.git'))
|
||||
api.nvim_win_set_cursor(0, pos)
|
||||
exec_lua(function()
|
||||
vim.lsp.buf.hover()
|
||||
@@ -1482,6 +1485,9 @@ describe('vim.pack', function()
|
||||
|
||||
local ref_pattern = 'Marvim <marvim@neovim%.io>\nDate:.*' .. vim.pesc(commit_msg)
|
||||
matches(ref_pattern, text)
|
||||
|
||||
exec_lua('vim.uv.os_unsetenv("GIT_WORK_TREE")')
|
||||
exec_lua('vim.uv.os_unsetenv("GIT_DIR")')
|
||||
end
|
||||
|
||||
assert_hover({ 14, 0 }, 'Commit from `main` to be removed')
|
||||
|
||||
Reference in New Issue
Block a user