mirror of
https://github.com/neovim/neovim.git
synced 2026-03-21 16:09:42 +00:00
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.
This commit is contained in:
committed by
GitHub
parent
448f15ca39
commit
fa3920282d
@@ -664,6 +664,19 @@ describe('vim.pack', function()
|
||||
eq('basic main', exec_lua('return require("basic")'))
|
||||
end)
|
||||
|
||||
it('is not affected by special environment variables', function()
|
||||
fn.setenv('GIT_WORK_TREE', fn.getcwd())
|
||||
fn.setenv('GIT_DIR', vim.fs.joinpath(fn.getcwd(), '.git'))
|
||||
local ref_environ = fn.environ()
|
||||
|
||||
exec_lua(function()
|
||||
vim.pack.add({ repos_src.basic })
|
||||
end)
|
||||
eq('basic main', exec_lua('return require("basic")'))
|
||||
|
||||
eq(ref_environ, fn.environ())
|
||||
end)
|
||||
|
||||
it('validates input', function()
|
||||
local validate = function(err_pat, input)
|
||||
local add_input = function()
|
||||
@@ -1163,6 +1176,20 @@ describe('vim.pack', function()
|
||||
eq({ 'return "fetch new 2"' }, fn.readfile(fetch_lua_file))
|
||||
end)
|
||||
|
||||
it('is not affected by special environment variables', function()
|
||||
fn.setenv('GIT_WORK_TREE', fn.getcwd())
|
||||
fn.setenv('GIT_DIR', vim.fs.joinpath(fn.getcwd(), '.git'))
|
||||
local ref_environ = fn.environ()
|
||||
|
||||
exec_lua(function()
|
||||
vim.pack.add({ repos_src.fetch })
|
||||
vim.pack.update({ 'fetch' }, { force = true })
|
||||
end)
|
||||
eq({ 'return "fetch new 2"' }, fn.readfile(fetch_lua_file))
|
||||
|
||||
eq(ref_environ, fn.environ())
|
||||
end)
|
||||
|
||||
it('validates input', function()
|
||||
local validate = function(err_pat, input)
|
||||
local update_input = function()
|
||||
|
||||
Reference in New Issue
Block a user