Skip to content

Commit 05a183c

Browse files
authored
Merge pull request #156 from lambdalisue/fix-resolve
Propery resolve from `cwd` in `revParse` function
2 parents b564a2e + 48cc19c commit 05a183c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

denops/gin/git/finder.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export async function findWorktree(cwd: string): Promise<string> {
4646
"--show-superproject-working-tree",
4747
]);
4848
} catch (e) {
49-
result = e as Error;
49+
if (e instanceof Error) {
50+
result = e;
51+
} else {
52+
throw e;
53+
}
5054
}
5155
cacheWorktree.set(path, result);
5256
return result;
@@ -70,7 +74,11 @@ export async function findGitdir(cwd: string): Promise<string> {
7074
try {
7175
result = await revParse(path, ["--git-dir"]);
7276
} catch (e) {
73-
result = e as Error;
77+
if (e instanceof Error) {
78+
result = e;
79+
} else {
80+
throw e;
81+
}
7482
}
7583
cacheGitdir.set(path, result);
7684
return result;
@@ -99,5 +107,5 @@ async function isWorktreeRoot(currentPath: string): Promise<boolean> {
99107
async function revParse(cwd: string, args: string[]): Promise<string> {
100108
const stdout = await execute(["rev-parse", ...args], { cwd });
101109
const output = decodeUtf8(stdout);
102-
return resolve(output.split(/\n/, 2)[0]);
110+
return resolve(cwd, output.split(/\n/, 2)[0]);
103111
}

0 commit comments

Comments
 (0)