Skip to content

Commit 6dc8899

Browse files
committed
👍 Fix findWorktree cache issue
1 parent 16df30d commit 6dc8899

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

denops/gin/git/finder.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ const cacheWorktree = new Cache<string, string | Error>(ttl);
1313
* @returns A root path of a git working directory.
1414
*/
1515
export async function findWorktree(cwd: string): Promise<string> {
16-
const result = cacheWorktree.get(cwd) ?? await (async () => {
16+
const path = await Deno.realPath(cwd);
17+
const result = cacheWorktree.get(path) ?? await (async () => {
1718
let result: string | Error;
1819
try {
19-
result = await revParse(cwd, [
20+
result = await revParse(path, [
2021
"--show-toplevel",
2122
"--show-superproject-working-tree",
2223
]);
2324
} catch (e) {
2425
result = e;
2526
}
26-
cacheWorktree.set(cwd, result);
27+
cacheWorktree.set(path, result);
2728
return result;
2829
})();
2930
if (result instanceof Error) {

0 commit comments

Comments
 (0)