Skip to content

Commit d93a18d

Browse files
committed
remove redundant code
1 parent 0a99e14 commit d93a18d

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

denops/gin/git/finder.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,7 @@ async function isWorktreeRoot(currentPath: string): Promise<boolean> {
9797
}
9898

9999
async function revParse(cwd: string, args: string[]): Promise<string> {
100-
// First, try to execute git rev-parse from the current directory
101-
// This will work correctly even if we're in a worktree inside .git
102-
try {
103-
const stdout = await execute(["rev-parse", ...args], { cwd });
104-
const output = decodeUtf8(stdout);
105-
return resolve(output.split(/\n/, 2)[0]);
106-
} catch (e) {
107-
// If it fails and we're in a .git directory, try from parent
108-
const terms = cwd.split(SEPARATOR);
109-
if (terms.includes(".git")) {
110-
const index = terms.indexOf(".git");
111-
const parentCwd = terms.slice(0, index).join(SEPARATOR);
112-
const stdout = await execute(["rev-parse", ...args], { cwd: parentCwd });
113-
const output = decodeUtf8(stdout);
114-
return resolve(output.split(/\n/, 2)[0]);
115-
}
116-
throw e;
117-
}
100+
const stdout = await execute(["rev-parse", ...args], { cwd });
101+
const output = decodeUtf8(stdout);
102+
return resolve(output.split(/\n/, 2)[0]);
118103
}

0 commit comments

Comments
 (0)