diff options
| author | fleesk <48991514+fleesk@users.noreply.github.com> | 2026-04-22 10:46:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 04:46:48 -0400 |
| commit | e53e728c925641397bc25969457db67189a2eb75 (patch) | |
| tree | c172e7b0c748f59d9aba8058f735fb8ff664195e /runtime/lua | |
| parent | 44770bb924844700e05aef4f81850f0378183ad9 (diff) | |
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.
Diffstat (limited to 'runtime/lua')
| -rw-r--r-- | runtime/lua/vim/pack/_lsp.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/lua/vim/pack/_lsp.lua b/runtime/lua/vim/pack/_lsp.lua index 7eedf9dfe5..a3342e9a30 100644 --- a/runtime/lua/vim/pack/_lsp.lua +++ b/runtime/lua/vim/pack/_lsp.lua @@ -218,7 +218,11 @@ methods['textDocument/hover'] = function(params, callback) local res = { contents = { kind = vim.lsp.protocol.MarkupKind.Markdown, value = markdown } } callback(nil, res) end - vim.system(cmd, { cwd = path }, vim.schedule_wrap(on_exit)) + + -- temporarily clear GIT env vars + local env = vim.fn.environ() --- @type table<string,string> + env.GIT_DIR, env.GIT_WORK_TREE = nil, nil + vim.system(cmd, { cwd = path, env = env, clear_env = true }, vim.schedule_wrap(on_exit)) end local dispatchers = {} |
