diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-09-08 00:42:09 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-07 14:42:09 -0700 |
| commit | fa3920282da007f0ea7ce37873ccb3c1db0af0ec (patch) | |
| tree | 29f138195575d0d8679e51a55c5c7f3ebbecb877 /runtime/lua/vim/pack.lua | |
| parent | 448f15ca396aa7007eb2c5cb82dd2ea6c5c82953 (diff) | |
| download | rneovim-fa3920282da007f0ea7ce37873ccb3c1db0af0ec.tar.gz rneovim-fa3920282da007f0ea7ce37873ccb3c1db0af0ec.tar.bz2 rneovim-fa3920282da007f0ea7ce37873ccb3c1db0af0ec.zip | |
fix(pack): handle Git environment variables #35626
Problem: Some environment variables which are useful when working inside
a bare repository can affect any Git operation.
Solution: Explicitly unset problematic environment variables.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
| -rw-r--r-- | runtime/lua/vim/pack.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index de3a64c325..2962c994f7 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -107,7 +107,9 @@ local M = {} local function git_cmd(cmd, cwd) -- Use '-c gc.auto=0' to disable `stderr` "Auto packing..." messages cmd = vim.list_extend({ 'git', '-c', 'gc.auto=0' }, cmd) - local sys_opts = { cwd = cwd, text = true, clear_env = true } + local env = vim.fn.environ() --- @type table<string,string> + env.GIT_DIR, env.GIT_WORK_TREE = nil, nil + local sys_opts = { cwd = cwd, text = true, env = env, clear_env = true } local out = async.await(3, vim.system, cmd, sys_opts) --- @type vim.SystemCompleted async.await(1, vim.schedule) if out.code ~= 0 then |