From 2f3e3e4e619309230951a555ad9abfa79ba7932c Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 15 Dec 2022 13:02:54 +0000 Subject: [PATCH] fix: do not error if cwd does not exist --- lua/gitsigns/git.lua | 5 +++++ teal/gitsigns/git.tl | 5 +++++ types/vim.d.tl | 2 ++ 3 files changed, 12 insertions(+) diff --git a/lua/gitsigns/git.lua b/lua/gitsigns/git.lua index 454e9f92a..1fc778e02 100644 --- a/lua/gitsigns/git.lua +++ b/lua/gitsigns/git.lua @@ -175,6 +175,11 @@ M.command = wrap(function(args, spec, callback) spec.command = spec.command or 'git' spec.args = spec.command == 'git' and { '--no-pager', '--literal-pathspecs', unpack(args) } or args + + if not spec.cwd and not uv.cwd() then + spec.cwd = vim.env.HOME + end + subprocess.run_job(spec, function(_, _, stdout, stderr) if not spec.suppress_stderr then if stderr then diff --git a/teal/gitsigns/git.tl b/teal/gitsigns/git.tl index 42227df6b..c7382cbcf 100644 --- a/teal/gitsigns/git.tl +++ b/teal/gitsigns/git.tl @@ -175,6 +175,11 @@ M.command = wrap(function(args: {string}, spec: GJobSpec, callback: function({st spec.command = spec.command or 'git' spec.args = spec.command == 'git' and { '--no-pager', '--literal-pathspecs', unpack(args) } or args + + if not spec.cwd and not uv.cwd() then + spec.cwd = vim.env.HOME + end + subprocess.run_job(spec as JobSpec, function(_: integer, _: integer, stdout: string, stderr: string) if not spec.suppress_stderr then if stderr then diff --git a/types/vim.d.tl b/types/vim.d.tl index 47e463017..2bfb29535 100644 --- a/types/vim.d.tl +++ b/types/vim.d.tl @@ -18,6 +18,8 @@ local record M -- Assume result_type == 'indices' diff: function(string|{string}, string|{string}, table): {DiffResult} + env: {string:string} + record go operatorfunc: string end