MCPcopy
hub / github.com/coder/mux / findGitRootFromGitExePath

Function findGitRootFromGitExePath

src/node/utils/main/bashPath.ts:86–102  ·  view source on GitHub ↗
(gitExePath: string, existsSyncFn: ExistsSyncFn)

Source from the content-addressed store, hash-verified

84}
85
86function findGitRootFromGitExePath(gitExePath: string, existsSyncFn: ExistsSyncFn): string | null {
87 let dir = WIN_PATH.dirname(WIN_PATH.dirname(WIN_PATH.normalize(gitExePath)));
88
89 for (let i = 0; i < 4; i++) {
90 if (existsSyncFn(WIN_PATH.join(dir, "cmd", "git.exe"))) {
91 return dir;
92 }
93
94 const parent = WIN_PATH.dirname(dir);
95 if (parent === dir) {
96 break;
97 }
98 dir = parent;
99 }
100
101 return null;
102}
103
104/**
105 * Find bash executable path on Windows.

Callers 1

findWindowsBashFunction · 0.85

Calls 1

existsSyncFnFunction · 0.85

Tested by

no test coverage detected