fix(git): add env option for util.exec
This commit is contained in:
@@ -192,6 +192,7 @@ end
|
||||
---@field cwd string?
|
||||
---@field stdin string?
|
||||
---@field silent boolean?
|
||||
---@field env table<string, string>?
|
||||
---@field on_exit fun(result: vim.SystemCompleted)?
|
||||
|
||||
---@param cmd string[]
|
||||
@@ -222,10 +223,16 @@ function M.exec(cmd, opts)
|
||||
return result.stdout or ""
|
||||
end
|
||||
|
||||
M.DEFAULT_GIT_ENV = {
|
||||
GIT_TERMINAL_PROMPT = "false",
|
||||
}
|
||||
|
||||
---@param args string[]
|
||||
---@param opts ow.Git.Util.ExecOpts?
|
||||
---@return string?
|
||||
function M.git(args, opts)
|
||||
opts = opts or {}
|
||||
opts.env = vim.tbl_extend("force", M.DEFAULT_GIT_ENV, opts.env or {})
|
||||
local cmd = { "git" }
|
||||
vim.list_extend(cmd, args)
|
||||
return M.exec(cmd, opts)
|
||||
|
||||
Reference in New Issue
Block a user