From 48cc19cf38bf0c02482738bc6873c0235f41cf42 Mon Sep 17 00:00:00 2001 From: Alisue Date: Thu, 19 Jun 2025 10:50:30 +0900 Subject: [PATCH] Propery resolve from `cwd` in `revParse` function --- denops/gin/git/finder.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/denops/gin/git/finder.ts b/denops/gin/git/finder.ts index 12fe4350..d3b833ae 100644 --- a/denops/gin/git/finder.ts +++ b/denops/gin/git/finder.ts @@ -46,7 +46,11 @@ export async function findWorktree(cwd: string): Promise { "--show-superproject-working-tree", ]); } catch (e) { - result = e as Error; + if (e instanceof Error) { + result = e; + } else { + throw e; + } } cacheWorktree.set(path, result); return result; @@ -70,7 +74,11 @@ export async function findGitdir(cwd: string): Promise { try { result = await revParse(path, ["--git-dir"]); } catch (e) { - result = e as Error; + if (e instanceof Error) { + result = e; + } else { + throw e; + } } cacheGitdir.set(path, result); return result; @@ -99,5 +107,5 @@ async function isWorktreeRoot(currentPath: string): Promise { async function revParse(cwd: string, args: string[]): Promise { const stdout = await execute(["rev-parse", ...args], { cwd }); const output = decodeUtf8(stdout); - return resolve(output.split(/\n/, 2)[0]); + return resolve(cwd, output.split(/\n/, 2)[0]); }